diff --git a/.bzrignore b/.bzrignore deleted file mode 100644 index d5874ebf0f2..00000000000 --- a/.bzrignore +++ /dev/null @@ -1,1461 +0,0 @@ -*-t -*.a -*.bb -*.bbg -*.bin -*.cdf -*.core -*.d -*.da -*.dgcov -*.dir/ -*.dll -*.dsp -*.dylib -*.exe -*.exp -*.gcda -*.gcno -*.gcov -*.idb -*.ilk -*.la -*.lai -*.lib -*.lo -*.manifest -*.map -*.o -*.obj -*.old -*.pch -*.pdb -*.Plo -*.Po -*.reject -*.res -*.rule -*.sbr -*.so -*.so.* -*.spec -*.Tpo -*.user -*.vcproj -*.vcproj.cmake -*.vcxproj -*.vcxproj.filters -Debug -MySql.sdf -Win32 -RelWithDebInfo -*~ -.*.swp -./CMakeCache.txt -./config.h -./fix-project-files -./mysql*.ds? -./MySql.ncb -./MySql.sln -./MySql.suo -./prepare -./README.build-files -.defs.mk -.depend -.depend.mk -.DS_Store -.gdb_history -.gdbinit -.o -.out -.snprj/* -.vimrc -ac_available_languages_fragment -BitKeeper/ -client/*.ds? -client/completion_hash.cpp -client/decimal.c -client/dtoa.c -client/echo -client/insert_test -client/link_sources -client/log_event.cc -client/log_event.h -client/log_event_old.cc -client/log_event_old.h -client/mf_iocache.c -client/mf_iocache.cc -client/my_decimal.cc -client/my_decimal.h -client/my_user.c -client/mysql -client/mysql.cpp -client/mysql_upgrade -client/mysqladmin -client/mysqladmin.c -client/mysqladmin.cpp -client/mysqlbinlog -client/mysqlbinlog.cpp -client/mysqlcheck -client/mysqldump -client/mysqlimport -client/mysqlmanager-pwgen -client/mysqlmanagerc -client/mysqlshow -client/mysqlslap -client/mysqltest -client/mysqltestmanager-pwgen -client/mysqltestmanagerc -client/mysys_priv.h -client/readline.cpp -client/rpl_constants.h -client/rpl_filter.cc -client/rpl_filter.h -client/rpl_record_old.cc -client/rpl_record_old.h -client/rpl_tblmap.cc -client/rpl_tblmap.h -client/rpl_utility.cc -client/rpl_utility.h -client/rpl_utility.cc -client/select_test -client/sql_const.h -client/sql_list.cc -client/sql_list.h -client/sql_string.cpp -client/ssl_test -client/thimble -client/thread_test -client/tmp.diff -client/transaction.h -client/async_example -client_debug/* -client_release/* -client_test -cmake_install.cmake -CMakeFiles/ -cmd-line-utils/libedit/common.h -cmd-line-utils/libedit/makelist -comments -comon.h -comp_err/*.ds? -compile -config.h -contrib/*.ds? -COPYING -COPYING.LIB -core -core.* -cscope.in.out -cscope.out -cscope.po.out -CTestTestfile.cmake -dbug/*.ds? -dbug/dbug_analyze -dbug/example*.r -dbug/factorial -dbug/factorial.r -dbug/main.r -dbug/output*.r -dbug/tests -dbug/user.ps -dbug/user.t -debian/control -debian/defs.mk -debian/dist/Debian/mariadb-server-10.0.files -debian/dist/Ubuntu/mariadb-server-10.0.files -debug/ -depcomp -Docs/INSTALL-BINARY -examples/*.ds? -examples/udf_example/udf_example.def -EXCEPTIONS-CLIENT -extra/charset2html -extra/comp_err -extra/created_include_files -extra/innochecksum -extra/libevent/event-config.h -extra/my_print_defaults -extra/mysql_install -extra/mysql_tzinfo_to_sql -extra/mysql_waitpid -extra/mysqld_ername.h -extra/mysqld_error.h -extra/perror -extra/replace -extra/resolve_stack_dump -extra/resolveip -extra/sql_state.h -extra/tztime.cc -extra/yassl/taocrypt/benchmark/benchmark -extra/yassl/taocrypt/test/test -extra/yassl/testsuite/testsuite -fcns.c -fcns.h -gdbinit -gmon.out -hardcopy.0 -heap/*.ds? -heap/hp_test1 -heap/hp_test2 -help -help.c -help.h -include/abi_check -include/check_abi -include/link_sources -include/my_config.h -include/my_global.h -include/mysql_h.ic -include/mysql_version.h -include/mysqld_ername.h -include/mysqld_error.h -include/mysqld_error.h.rule -include/openssl -include/probes_mysql_dtrace.h -include/readline -include/readline/*.h -include/readline/readline.h -include/sql_state.h -include/widec.h -insert_test -install -install-sh -INSTALL-SOURCE -INSTALL-WIN-SOURCE -item_xmlfunc.cc -lib_debug/* -lib_release/* -libmysql/*.c -libmysql/*.ds? -libmysql/conf_to_src -libmysql/debug/libmysql.exp -libmysql/libmysql.ver -libmysql/libmysql_exports_file.cc -libmysql/link_sources -libmysql/merge_archives_mysqlclient.cmake -libmysql/my_static.h -libmysql/my_time.c -libmysql/mysys_priv.h -libmysql/net.c -libmysql/release/libmysql.exp -libmysql/vio_priv.h -libmysql/viosocket.o.6WmSJk -libmysql_r/*.c -libmysql_r/client_settings.h -libmysql_r/conf_to_src -libmysql_r/link_sources -libmysql_r/my_static.h -libmysql_r/mysys_priv.h -libmysql_r/vio_priv.h -libmysqld/*.ds? -libmysqld/backup_dir -libmysqld/client.c -libmysqld/client_plugin.c -libmysqld/client_settings.h -libmysqld/cmake_dummy.c -libmysqld/convert.cc -libmysqld/create_options.cc -libmysqld/datadict.cc -libmysqld/debug_sync.cc -libmysqld/derror.cc -libmysqld/des_key_file.cc -libmysqld/discover.cc -libmysqld/discover_xt.cc -libmysqld/emb_qcache.cpp -libmysqld/errmsg.c -libmysqld/event.cc -libmysqld/event_data_objects.cc -libmysqld/event_db_repository.cc -libmysqld/event_executor.cc -libmysqld/event_parse_data.cc -libmysqld/event_queue.cc -libmysqld/event_scheduler.cc -libmysqld/event_timed.cc -libmysqld/events.cc -libmysqld/examples/client_test.c -libmysqld/examples/client_test.cc -libmysqld/examples/completion_hash.cc -libmysqld/examples/completion_hash.h -libmysqld/examples/link_sources -libmysqld/examples/my_readline.h -libmysqld/examples/mysql -libmysqld/examples/mysql.cc -libmysqld/examples/mysql_client_test.c -libmysqld/examples/mysql_client_test_embedded -libmysqld/examples/mysql_embedded -libmysqld/examples/mysqltest -libmysqld/examples/mysqltest.c -libmysqld/examples/mysqltest.cc -libmysqld/examples/mysqltest_embedded -libmysqld/examples/readline.cc -libmysqld/examples/sql_string.cc -libmysqld/examples/sql_string.h -libmysqld/examples/test-gdbinit -libmysqld/field.cc -libmysqld/field_conv.cc -libmysqld/filesort.cc -libmysqld/get_password.c -libmysqld/gstream.cc -libmysqld/ha_archive.cc -libmysqld/ha_berkeley.cc -libmysqld/ha_blackhole.cc -libmysqld/ha_example.cc -libmysqld/ha_federated.cc -libmysqld/ha_federatedx.cc -libmysqld/ha_heap.cc -libmysqld/ha_innobase.cc -libmysqld/ha_innodb.cc -libmysqld/ha_maria.cc -libmysqld/ha_myisam.cc -libmysqld/ha_myisammrg.cc -libmysqld/ha_ndbcluster.cc -libmysqld/ha_ndbcluster_binlog.cc -libmysqld/ha_ndbcluster_cond.cc -libmysqld/ha_partition.cc -libmysqld/ha_tina.cc -libmysqld/handler.cc -libmysqld/handlerton.cc -libmysqld/hash_filo.cc -libmysqld/hostname.cc -libmysqld/init.cc -libmysqld/item.cc -libmysqld/item_buff.cc -libmysqld/item_cmpfunc.cc -libmysqld/item_create.cc -libmysqld/item_func.cc -libmysqld/item_geofunc.cc -libmysqld/item_row.cc -libmysqld/item_strfunc.cc -libmysqld/item_subselect.cc -libmysqld/item_sum.cc -libmysqld/item_timefunc.cc -libmysqld/item_uniq.cc -libmysqld/key.cc -libmysqld/keycaches.cc -libmysqld/lex_hash.h -libmysqld/lib_sql.cpp -libmysqld/libmysql.c -libmysqld/link_sources -libmysqld/lock.cc -libmysqld/log.cc -libmysqld/log_event.cc -libmysqld/log_event_old.cc -libmysqld/md5.c -libmysqld/mdl.cc -libmysqld/merge_archives_mysqlserver.cmake -libmysqld/message.h -libmysqld/message.rc -libmysqld/mf_iocache.cc -libmysqld/mini_client.cc -libmysqld/multi_range_read.cc -libmysqld/my_decimal.cc -libmysqld/my_time.c -libmysqld/my_user.c -libmysqld/mysqlserver_depends.c -libmysqld/myxt_xt.cc -libmysqld/net_pkg.cc -libmysqld/net_serv.cc -libmysqld/opt_ft.cc -libmysqld/opt_index_cond_pushdown.cc -libmysqld/opt_range.cc -libmysqld/opt_subselect.cc -libmysqld/opt_sum.cc -libmysqld/opt_table_elimination.cc -libmysqld/pack.c -libmysqld/parse_file.cc -libmysqld/partition_info.cc -libmysqld/password.c -libmysqld/procedure.cc -libmysqld/protocol.cc -libmysqld/protocol_cursor.cc -libmysqld/records.cc -libmysqld/repl_failsafe.cc -libmysqld/rpl_filter.cc -libmysqld/rpl_handler.cc -libmysqld/rpl_injector.cc -libmysqld/rpl_record.cc -libmysqld/rpl_record_old.cc -libmysqld/rpl_utility.cc -libmysqld/scheduler.cc -libmysqld/set_var.cc -libmysqld/sha2.cc -libmysqld/simple-test -libmysqld/slave.cc -libmysqld/sp.cc -libmysqld/sp_cache.cc -libmysqld/sp_head.cc -libmysqld/sp_pcontext.cc -libmysqld/sp_rcontext.cc -libmysqld/spatial.cc -libmysqld/sql_acl.cc -libmysqld/sql_admin.cc -libmysqld/sql_alter.cc -libmysqld/sql_analyse.cc -libmysqld/sql_audit.cc -libmysqld/sql_base.cc -libmysqld/sql_builtin.cc -libmysqld/sql_cache.cc -libmysqld/sql_class.cc -libmysqld/sql_command -libmysqld/sql_connect.cc -libmysqld/sql_crypt.cc -libmysqld/sql_cursor.cc -libmysqld/sql_cursor.h -libmysqld/sql_db.cc -libmysqld/sql_delete.cc -libmysqld/sql_derived.cc -libmysqld/sql_do.cc -libmysqld/sql_error.cc -libmysqld/sql_expression_cache.cc -libmysqld/sql_handler.cc -libmysqld/sql_help.cc -libmysqld/sql_insert.cc -libmysqld/sql_join_cache.cc -libmysqld/sql_lex.cc -libmysqld/sql_list.cc -libmysqld/sql_load.cc -libmysqld/sql_locale.cc -libmysqld/sql_manager.cc -libmysqld/sql_map.cc -libmysqld/sql_olap.cc -libmysqld/sql_parse.cc -libmysqld/sql_partition.cc -libmysqld/sql_partition_admin.cc -libmysqld/sql_plugin.cc -libmysqld/sql_prepare.cc -libmysqld/sql_profile.cc -libmysqld/sql_reload.cc -libmysqld/sql_rename.cc -libmysqld/sql_repl.cc -libmysqld/sql_select.cc -libmysqld/sql_servers.cc -libmysqld/sql_show.cc -libmysqld/sql_signal.cc -libmysqld/sql_state.c -libmysqld/sql_string.cc -libmysqld/sql_table.cc -libmysqld/sql_tablespace.cc -libmysqld/sql_test.cc -libmysqld/sql_time.cc -libmysqld/sql_trigger.cc -libmysqld/sql_truncate.cc -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/sql_yacc.cpp -libmysqld/sql_yacc.h -libmysqld/stacktrace.c -libmysqld/strfunc.cc -libmysqld/sys_vars.cc -libmysqld/table.cc -libmysqld/thr_malloc.cc -libmysqld/transaction.cc -libmysqld/tztime.cc -libmysqld/uniques.cc -libmysqld/unireg.cc -libmysqld/discover_xt.cc -libmysqld/myxt_xt.cc -libmysqld/rpl_reporting.cc -libmysqld/rpl_utility.cc -libmysqltest/*.ds? -libmysqltest/mytest.c -libtool -linked_client_sources -linked_include_sources -linked_libmysql_r_sources -linked_libmysql_sources -linked_libmysqld_sources -linked_libmysqldex_sources -linked_server_sources -linked_tools_sources -locked -ltmain.sh -ma_test_recovery.output -make_dist.cmake -Makefile -Makefile.in -MinSizeRel/ -MIRRORS -missing -mkinstalldirs -my_print_defaults/*.ds? -myisam_ftdump/*.ds? -myisamchk/*.ds? -myisamlog/*.ds? -myisammrg/*.ds? -myisampack/*.ds? -mysql-test/*.ds? -mysql-test/install_test_db -mysql-test/lib/init_db.sql -mysql-test/lib/My/SafeProcess/my_safe_process -mysql-test/mtr -mysql-test/mysql-test-run -mysql-test/r/*.err -mysql-test/r/*.log -mysql-test/r/*.out -mysql-test/r/*.reject -mysql-test/var -mysql.kdevprj -mysql.proj -mysqlbinlog/*.ds? -mysqlcheck/*.ds? -mysqld.S -mysqld.sym -mysqldemb/*.ds? -mysqlserver/*.ds? -mysys/*.ds? -mysys/charset2html -mysys/getopt.c -mysys/getopt1.c -mysys/main.cc -mysys/my_new.cpp -mysys/raid.cpp -mysys/ste5KbMa -mysys/test_atomic -mysys/test_bitmap -mysys/test_charset -mysys/test_dir -mysys/test_gethwaddr -mysys/test_io_cache -mysys/test_thr_alarm -mysys/test_thr_lock -mysys/test_vsnprintf -mysys/testhash -mysys/thr_lock -perror/*.ds? -regex/*.ds? -regex/re -Release/ -RelWithDebInfo/ -replace/*.ds? -scripts/comp_sql -scripts/convert-debug-for-diff -scripts/fill_func_tables -scripts/fill_func_tables.sql -scripts/fill_help_tables -scripts/fill_help_tables.sql -scripts/make_binary_distribution -scripts/make_sharedlib_distribution -scripts/make_win_binary_distribution -scripts/make_win_src_distribution -scripts/make_win_src_distribution_old -scripts/msql2mysql -scripts/mysql_config -scripts/mysql_convert_table_format -scripts/mysql_create_system_tables -scripts/mysql_explain_log -scripts/mysql_find_rows -scripts/mysql_fix_extensions -scripts/mysql_fix_privilege_tables -scripts/mysql_fix_privilege_tables.sql -scripts/mysql_fix_privilege_tables.sql.rule -scripts/mysql_fix_privilege_tables_sql.c -scripts/mysql_fix_privilege_tables_sql.c.rule -scripts/mysql_install_db -scripts/mysql_secure_installation -scripts/mysql_setpermission -scripts/mysql_tableinfo -scripts/mysql_upgrade -scripts/mysql_upgrade_shell -scripts/mysql_zap -scripts/mysqlaccess -scripts/mysqlbug -scripts/mysqld_multi -scripts/mysqld_safe -scripts/mysqldumpslow -scripts/mysqlhotcopy -scripts/mysqlhotcopy.sh.rej -scripts/safe_mysqld -select_test -sql-bench/bench-count-distinct -sql-bench/bench-init.pl -sql-bench/compare-results -sql-bench/compare-results-all -sql-bench/copy-db -sql-bench/crash-me -sql-bench/gif/* -sql-bench/graph-compare-results -sql-bench/innotest1 -sql-bench/innotest1a -sql-bench/innotest1b -sql-bench/innotest2 -sql-bench/innotest2a -sql-bench/innotest2b -sql-bench/output/* -sql-bench/Results-linux/ATIS-mysql_bdb-Linux_2.2.14_my_SMP_i686 -sql-bench/run-all-tests -sql-bench/server-cfg -sql-bench/template.html -sql-bench/test-alter-table -sql-bench/test-ATIS -sql-bench/test-big-tables -sql-bench/test-connect -sql-bench/test-create -sql-bench/test-insert -sql-bench/test-select -sql-bench/test-transactions -sql-bench/test-wisconsin -sql/*.cpp -sql/*.ds? -sql/client.c -sql/client_plugin.c -sql/Doxyfile -sql/gen_lex_hash -sql/lex_hash.h -sql/lex_hash.h.rule -sql/link_sources -sql/message.h -sql/message.mc -sql/message.rc -sql/mini_client_errors.c -sql/my_time.c -sql/my_user.c -sql/mysql_tzinfo_to_sql -sql/mysql_tzinfo_to_sql.cc -sql/mysql_tzinfo_to_sql_tztime.cc -sql/mysqlbinlog -sql/mysqld -sql/mysqld-purecov -sql/mysqld-purify -sql/mysqld-quantify -sql/new.cc -sql/pack.c -sql/share/*/*.sys -sql/sql_builtin.cc -sql/sql_yacc.cc -sql/sql_yacc.h -sql/sql_yacc.h.rule -sql/sql_yacc.output -sql_error.cc -sql_prepare.cc -sql_priv.h -stamp-h -storage/archive/archive_reader -storage/archive/archive_test -storage/heap/hp_test1 -storage/heap/hp_test2 -storage/maria/*.MAD -storage/maria/*.MAI -storage/maria/aria.log -storage/maria/aria_chk -storage/maria/aria_control -storage/maria/aria_dump_log -storage/maria/aria_ftdump -storage/maria/aria_log -storage/maria/aria_log.* -storage/maria/aria_pack -storage/maria/aria_read_log -storage/maria/ma_rt_test -storage/maria/ma_sp_test -storage/maria/ma_test1 -storage/maria/ma_test2 -storage/maria/ma_test3 -storage/maria/ma_test_all -storage/maria/tmp -storage/maria/unittest/ma_pagecache_consist_1k-t-big -storage/maria/unittest/ma_pagecache_consist_1kHC-t-big -storage/maria/unittest/ma_pagecache_consist_1kRD-t-big -storage/maria/unittest/ma_pagecache_consist_1kWR-t-big -storage/maria/unittest/ma_pagecache_consist_64k-t-big -storage/maria/unittest/ma_pagecache_consist_64kHC-t-big -storage/maria/unittest/ma_pagecache_consist_64kRD-t-big -storage/maria/unittest/ma_pagecache_consist_64kWR-t-big -storage/maria/unittest/ma_pagecache_single_64k-t-big -storage/maria/unittest/ma_test_loghandler_long-t-big -storage/maria/unittest/maria_control -storage/maria/unittest/mf_pagecache_consist_1k-t-big -storage/maria/unittest/mf_pagecache_consist_1kHC-t-big -storage/maria/unittest/mf_pagecache_consist_1kRD-t-big -storage/maria/unittest/mf_pagecache_consist_1kWR-t-big -storage/maria/unittest/mf_pagecache_consist_64k-t-big -storage/maria/unittest/mf_pagecache_consist_64kHC-t-big -storage/maria/unittest/mf_pagecache_consist_64kRD-t-big -storage/maria/unittest/mf_pagecache_consist_64kWR-t-big -storage/maria/unittest/mf_pagecache_single_64k-t-big -storage/maria/unittest/page_cache_test_file_1 -storage/maria/unittest/pagecache_debug.log -storage/maria/unittest/tmp -storage/myisam/FT1.MYD -storage/myisam/FT1.MYI -storage/myisam/ft_dump -storage/myisam/ft_eval -storage/myisam/ft_test1 -storage/myisam/ftbench/data -storage/myisam/ftbench/t -storage/myisam/ftbench/var/* -storage/myisam/mi_test1 -storage/myisam/mi_test2 -storage/myisam/mi_test3 -storage/myisam/mi_test_all -storage/myisam/myisam.log -storage/myisam/myisam_ftdump -storage/myisam/myisamchk -storage/myisam/myisamlog -storage/myisam/myisampack -storage/myisam/rt_test -storage/myisam/rt_test.MYD -storage/myisam/rt_test.MYI -storage/myisam/sp_test -storage/myisam/test1.MYD -storage/myisam/test1.MYI -storage/myisam/test2.MYD -storage/myisam/test2.MYI -storage/ndb/bin/acid -storage/ndb/bin/async-lmc-bench-l-p10.sh -storage/ndb/bin/async-lmc-bench-l.sh -storage/ndb/bin/async-lmc-bench-p10.sh -storage/ndb/bin/async-lmc-bench.sh -storage/ndb/bin/atrt -storage/ndb/bin/atrt-analyze-result.sh -storage/ndb/bin/atrt-clear-result.sh -storage/ndb/bin/atrt-gather-result.sh -storage/ndb/bin/atrt-setup.sh -storage/ndb/bin/bankCreator -storage/ndb/bin/bankMakeGL -storage/ndb/bin/bankSumAccounts -storage/ndb/bin/bankTimer -storage/ndb/bin/bankTransactionMaker -storage/ndb/bin/bankValidateAllGLs -storage/ndb/bin/basicTransporterTest -storage/ndb/bin/benchronja -storage/ndb/bin/bulk_copy -storage/ndb/bin/copy_tab -storage/ndb/bin/create_all_tabs -storage/ndb/bin/create_index -storage/ndb/bin/create_tab -storage/ndb/bin/DbAsyncGenerator -storage/ndb/bin/DbCreate -storage/ndb/bin/delete_all -storage/ndb/bin/desc -storage/ndb/bin/drop_all_tabs -storage/ndb/bin/drop_index -storage/ndb/bin/drop_tab -storage/ndb/bin/flexAsynch -storage/ndb/bin/flexBench -storage/ndb/bin/flexHammer -storage/ndb/bin/flexScan -storage/ndb/bin/flexTT -storage/ndb/bin/hugoCalculator -storage/ndb/bin/hugoFill -storage/ndb/bin/hugoLoad -storage/ndb/bin/hugoLockRecords -storage/ndb/bin/hugoPkDelete -storage/ndb/bin/hugoPkRead -storage/ndb/bin/hugoPkReadRecord -storage/ndb/bin/hugoPkUpdate -storage/ndb/bin/hugoScanRead -storage/ndb/bin/hugoScanUpdate -storage/ndb/bin/index -storage/ndb/bin/index2 -storage/ndb/bin/initronja -storage/ndb/bin/interpreterInTup -storage/ndb/bin/list_tables -storage/ndb/bin/make-config.sh -storage/ndb/bin/mgmtclient -storage/ndb/bin/mgmtsrvr -storage/ndb/bin/mkconfig -storage/ndb/bin/ndb -storage/ndb/bin/ndb_cpcc -storage/ndb/bin/ndb_cpcd -storage/ndb/bin/ndb_rep -storage/ndb/bin/ndbsql -storage/ndb/bin/newton_basic -storage/ndb/bin/newton_br -storage/ndb/bin/newton_pb -storage/ndb/bin/newton_perf -storage/ndb/bin/perfTransporterTest -storage/ndb/bin/printConfig -storage/ndb/bin/printSchemafile -storage/ndb/bin/printSysfile -storage/ndb/bin/redoLogFileReader -storage/ndb/bin/restart -storage/ndb/bin/restarter -storage/ndb/bin/restarter2 -storage/ndb/bin/restarts -storage/ndb/bin/restore -storage/ndb/bin/select_all -storage/ndb/bin/select_count -storage/ndb/bin/telco -storage/ndb/bin/test_cpcd -storage/ndb/bin/test_event -storage/ndb/bin/testBackup -storage/ndb/bin/testBank -storage/ndb/bin/testBasic -storage/ndb/bin/testBasicAsynch -storage/ndb/bin/testCopy -storage/ndb/bin/testDataBuffers -storage/ndb/bin/testDict -storage/ndb/bin/testGrep -storage/ndb/bin/testGrepVerify -storage/ndb/bin/testIndex -storage/ndb/bin/testInterpreter -storage/ndb/bin/testKernelDataBuffer -storage/ndb/bin/testLongSig -storage/ndb/bin/testMgm -storage/ndb/bin/testMgmapi -storage/ndb/bin/testNdbApi -storage/ndb/bin/testNodeRestart -storage/ndb/bin/testOdbcDriver -storage/ndb/bin/testOIBasic -storage/ndb/bin/testOperations -storage/ndb/bin/testRestartGci -storage/ndb/bin/testScan -storage/ndb/bin/testScanInterpreter -storage/ndb/bin/testSimplePropertiesSection -storage/ndb/bin/testSystemRestart -storage/ndb/bin/testTimeout -storage/ndb/bin/testTransactions -storage/ndb/bin/verify_index -storage/ndb/bin/waiter -storage/ndb/config/config.mk -storage/ndb/examples/ndbapi_example1/ndbapi_example1 -storage/ndb/examples/ndbapi_example2/ndbapi_example2 -storage/ndb/examples/ndbapi_example3/ndbapi_example3 -storage/ndb/examples/ndbapi_example5/ndbapi_example5 -storage/ndb/examples/select_all/select_all -storage/ndb/include/ndb_global.h -storage/ndb/include/ndb_types.h -storage/ndb/include/ndb_version.h -storage/ndb/lib/libMGM_API.so -storage/ndb/lib/libNDB_API.so -storage/ndb/lib/libNDB_ODBC.so -storage/ndb/lib/libndbclient.so -storage/ndb/lib/libndbclient_extra.so -storage/ndb/lib/libNEWTON_API.so -storage/ndb/lib/libNEWTON_BASICTEST_COMMON.so -storage/ndb/lib/libREP_API.so -storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent -storage/ndb/ndbapi-examples/mgmapi_logevent2/mgmapi_logevent2 -storage/ndb/ndbapi-examples/ndbapi_async/ndbapi_async -storage/ndb/ndbapi-examples/ndbapi_async1/ndbapi_async1 -storage/ndb/ndbapi-examples/ndbapi_event/ndbapi_event -storage/ndb/ndbapi-examples/ndbapi_retries/ndbapi_retries -storage/ndb/ndbapi-examples/ndbapi_scan/ndbapi_scan -storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple -storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual -storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index -storage/ndb/src/common/mgmcommon/printConfig/*.d -storage/ndb/src/common/util/testBitmask.cpp -storage/ndb/src/cw/cpcd/ndb_cpcd -storage/ndb/src/dummy.cpp -storage/ndb/src/kernel/blocks/backup/ndb_print_backup_file -storage/ndb/src/kernel/blocks/backup/restore/ndb_restore -storage/ndb/src/kernel/blocks/dbdict/ndb_print_schema_file -storage/ndb/src/kernel/blocks/dbdih/ndb_print_sys_file -storage/ndb/src/kernel/blocks/dbtup/test_varpage -storage/ndb/src/kernel/blocks/ndb_print_file -storage/ndb/src/kernel/ndbd -storage/ndb/src/libndb.ver -storage/ndb/src/mgmclient/ndb_mgm -storage/ndb/src/mgmclient/test_cpcd/*.d -storage/ndb/src/mgmsrv/ndb_mgmd -storage/ndb/src/ndbapi/ndberror_check -storage/ndb/test/ndbapi/bank/bankCreator -storage/ndb/test/ndbapi/bank/bankMakeGL -storage/ndb/test/ndbapi/bank/bankSumAccounts -storage/ndb/test/ndbapi/bank/bankTimer -storage/ndb/test/ndbapi/bank/bankTransactionMaker -storage/ndb/test/ndbapi/bank/bankValidateAllGLs -storage/ndb/test/ndbapi/bank/testBank -storage/ndb/test/ndbapi/create_all_tabs -storage/ndb/test/ndbapi/create_tab -storage/ndb/test/ndbapi/DbAsyncGenerator -storage/ndb/test/ndbapi/DbCreate -storage/ndb/test/ndbapi/drop_all_tabs -storage/ndb/test/ndbapi/flexAsynch -storage/ndb/test/ndbapi/flexBench -storage/ndb/test/ndbapi/flexHammer -storage/ndb/test/ndbapi/flexTT -storage/ndb/test/ndbapi/ndbapi_slow_select -storage/ndb/test/ndbapi/test_event -storage/ndb/test/ndbapi/test_event_merge -storage/ndb/test/ndbapi/testBackup -storage/ndb/test/ndbapi/testBasic -storage/ndb/test/ndbapi/testBasicAsynch -storage/ndb/test/ndbapi/testBitfield -storage/ndb/test/ndbapi/testBlobs -storage/ndb/test/ndbapi/testDataBuffers -storage/ndb/test/ndbapi/testDeadlock -storage/ndb/test/ndbapi/testDict -storage/ndb/test/ndbapi/testIndex -storage/ndb/test/ndbapi/testIndexStat -storage/ndb/test/ndbapi/testInterpreter -storage/ndb/test/ndbapi/testLcp -storage/ndb/test/ndbapi/testMgm -storage/ndb/test/ndbapi/testNdbApi -storage/ndb/test/ndbapi/testNodeRestart -storage/ndb/test/ndbapi/testOIBasic -storage/ndb/test/ndbapi/testOperations -storage/ndb/test/ndbapi/testPartitioning -storage/ndb/test/ndbapi/testReadPerf -storage/ndb/test/ndbapi/testRestartGci -storage/ndb/test/ndbapi/testScan -storage/ndb/test/ndbapi/testScanInterpreter -storage/ndb/test/ndbapi/testScanPerf -storage/ndb/test/ndbapi/testSRBank -storage/ndb/test/ndbapi/testSystemRestart -storage/ndb/test/ndbapi/testTimeout -storage/ndb/test/ndbapi/testTransactions -storage/ndb/test/run-test/atrt -storage/ndb/test/tools/copy_tab -storage/ndb/test/tools/create_index -storage/ndb/test/tools/hugoCalculator -storage/ndb/test/tools/hugoFill -storage/ndb/test/tools/hugoLoad -storage/ndb/test/tools/hugoLockRecords -storage/ndb/test/tools/hugoPkDelete -storage/ndb/test/tools/hugoPkRead -storage/ndb/test/tools/hugoPkReadRecord -storage/ndb/test/tools/hugoPkUpdate -storage/ndb/test/tools/hugoScanRead -storage/ndb/test/tools/hugoScanUpdate -storage/ndb/test/tools/listen_event -storage/ndb/test/tools/ndb_cpcc -storage/ndb/test/tools/rep_latency -storage/ndb/test/tools/restart -storage/ndb/test/tools/verify_index -storage/ndb/tools/ndb_config -storage/ndb/tools/ndb_delete_all -storage/ndb/tools/ndb_desc -storage/ndb/tools/ndb_drop_index -storage/ndb/tools/ndb_drop_table -storage/ndb/tools/ndb_restore -storage/ndb/tools/ndb_select_all -storage/ndb/tools/ndb_select_count -storage/ndb/tools/ndb_show_tables -storage/ndb/tools/ndb_test_platform -storage/ndb/tools/ndb_waiter -storage/xtradb/configure.lineno -storage/xtradb/conftest.s1 -storage/xtradb/conftest.subs -storage/xtradb/ib_config.h -storage/xtradb/ib_config.h.in -storage/xtradb/mkinstalldirs -storage/xtradb/stamp-h1 -strings/*.ds? -strings/conf_to_src -strings/ctype_autoconf.c -strings/ctype_extra_sources.c -strings/str_test -strings/test_decimal -support-files/*.ini -support-files/binary-configure -support-files/MacOSX/Description.plist -support-files/MacOSX/Info.plist -support-files/MacOSX/postflight -support-files/MacOSX/postinstall -support-files/MacOSX/preflight -support-files/MacOSX/preinstall -support-files/MacOSX/ReadMe.txt -support-files/MacOSX/StartupParameters.plist -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 -support-files/mysql-3.23.25-beta.spec -support-files/mysql-3.23.26-beta.spec -support-files/mysql-3.23.27-beta.spec -support-files/mysql-3.23.28-gamma.spec -support-files/mysql-3.23.29-gamma.spec -support-files/mysql-log-rotate -support-files/mysql.server -support-files/mysql.spec -support-files/mysqld_multi.server -support-files/ndb-config-2-node.ini -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/test_event -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/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 -test1/* -test?.MA? -test_xml -tests/*.ds? -tests/bug25714 -tests/client_test -tests/connect_test -tests/mysql_client_test -tests/async_queries -thr_insert_test/* -thr_test/* -thread_test -tmp -tmp/* -tools/my_vsnprintf.c -tools/mysqlmanager -tools/mysqlmngd -tools/mysqltestmanager -tools/mysys_priv.h -unittest/examples/*.t -unittest/maria_control -unittest/mysys/*.t -unittest/mysys/mf_pagecache_consist_1k-t-big -unittest/mysys/mf_pagecache_consist_1kHC-t-big -unittest/mysys/mf_pagecache_consist_1kRD-t-big -unittest/mysys/mf_pagecache_consist_1kWR-t-big -unittest/mysys/mf_pagecache_consist_64k-t-big -unittest/mysys/mf_pagecache_consist_64kHC-t-big -unittest/mysys/mf_pagecache_consist_64kRD-t-big -unittest/mysys/mf_pagecache_consist_64kWR-t-big -unittest/mysys/mf_pagecache_single_64k-t-big -unittest/mytap/t/*.t -unittest/page_cache_test_file_1 -unittest/pagecache_debug.log -unittest/tmp/* -unittest/unit -vi.h -vio/*.ds? -vio/test-ssl -vio/test-sslclient -vio/test-sslserver -vio/viotest-ssl -vio/viotest-sslconnect.cpp -vio/viotest.cpp -ylwrap -zlib/*.ds? -sql-bench/test-table-elimination -sql/share/bulgarian -sql/share/czech -sql/share/danish -sql/share/dutch -sql/share/english -sql/share/estonian -sql/share/french -sql/share/german -sql/share/greek -sql/share/hungarian -sql/share/italian -sql/share/japanese -sql/share/japanese-sjis -sql/share/korean -sql/share/norwegian -sql/share/norwegian-ny -sql/share/polish -sql/share/portuguese -sql/share/romanian -sql/share/russian -sql/share/serbian -sql/share/slovak -sql/share/spanish -sql/share/swedish -sql/share/ukrainian -CPackConfig.cmake -CPackSourceConfig.cmake -Docs/INFO_BIN -Docs/INFO_SRC -tags -Testing -info_macros.cmake -VERSION.dep -configure -libmysqld/examples/mysqltest.cc -extra/libevent/event-config.h -libmysqld/opt_table_elimination.cc -libmysqld/ha_federatedx.cc -libmysqld/multi_range_read.cc -libmysqld/opt_index_cond_pushdown.cc -libmysqld/opt_subselect.cc -libmysqld/sql_join_cache.cc -client/rpl_filter.cc -client/rpl_filter.h -client/sql_list.cc -client/sql_list.h -libmysqld/create_options.cc -libmysqld/sql_expression_cache.cc -mysql-test/mtr_command -scripts/convert-debug-for-diff -client/strings_def.h -libmysql/strings_def.h -libmysql_r/strings_def.h -storage/maria/aria_log_control -scripts/mytop -include/*.h.tmp -cmd-line-utils/libedit/emacs.h -mysql-test/collections/default.release -support-files/plugins.files -client/mysql_plugin -*.resource.txt -plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.c -plugin/handler_socket/perl-Net-HandlerSocket/blib -plugin/handler_socket/perl-Net-HandlerSocket/pm_to_blib -plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.bs -plugin/handler_socket/perl-Net-HandlerSocket/Makefile.PL -libmysqld/libmysqld_exports_file.cc -libmysqld/gcalc_slicescan.cc -libmysqld/gcalc_tools.cc -libmysqld/my_apc.cc -sql/share/errmsg.sys -sql/share/mysql -install_manifest.txt -sql/db.opt -./_CPack_Packages -./install_manifest_*.txt -typescript -storage/perfschema/gen_pfs_lex_token -storage/perfschema/pfs_lex_token.h -*.bak -*.OLD -mysql-test/collections/default.release.done -sql/sql_yacc.hh -packaging/solaris/postinstall-solaris -extra/jemalloc/jemalloc-* -extra/jemalloc/build -*.tdb -pcre/config.h -pcre/CTestCustom.ctest -pcre/pcre_grep_test.sh -pcre/pcre_scanner_unittest -pcre/pcre_stringpiece_unittest -pcre/pcre_test.sh -pcre/pcrecpp_unittest -pcre/pcregrep -pcre/pcretest -pcre/pcre.h -testNinput -teststderr -testtemp1 -testtemp2 -testtry -storage/tokudb/ft-index/CTestCustom.cmake -storage/tokudb/ft-index/DartConfiguration.tcl -storage/tokudb/ft-index/ctags-stamp -storage/tokudb/ft-index/valgrind.suppressions -storage/tokudb/ft-index/xz -storage/tokudb/ft-index/buildheader/db.h -storage/tokudb/ft-index/buildheader/make_tdb -storage/tokudb/ft-index/buildheader/runcat.sh -storage/tokudb/ft-index/ft/ftverify -storage/tokudb/ft-index/ft/log_code.cc -storage/tokudb/ft-index/ft/log_header.h -storage/tokudb/ft-index/ft/log_print.cc -storage/tokudb/ft-index/ft/logformat -storage/tokudb/ft-index/ft/tdb-recover -storage/tokudb/ft-index/ft/tdb_logprint -storage/tokudb/ft-index/ft/tokuftdump -storage/tokudb/ft-index/ft/tests/benchmark-test -storage/tokudb/ft-index/ft/tests/block_allocator_test -storage/tokudb/ft-index/ft/tests/bnc-insert-benchmark -storage/tokudb/ft-index/ft/tests/cachetable-4357 -storage/tokudb/ft-index/ft/tests/cachetable-4365 -storage/tokudb/ft-index/ft/tests/cachetable-5097 -storage/tokudb/ft-index/ft/tests/cachetable-5978 -storage/tokudb/ft-index/ft/tests/cachetable-5978-2 -storage/tokudb/ft-index/ft/tests/cachetable-all-write -storage/tokudb/ft-index/ft/tests/cachetable-checkpoint-pending -storage/tokudb/ft-index/ft/tests/cachetable-checkpoint-pinned-nodes -storage/tokudb/ft-index/ft/tests/cachetable-checkpoint-prefetched-nodes -storage/tokudb/ft-index/ft/tests/cachetable-checkpoint-test -storage/tokudb/ft-index/ft/tests/cachetable-checkpointer-class -storage/tokudb/ft-index/ft/tests/cachetable-cleaner-checkpoint -storage/tokudb/ft-index/ft/tests/cachetable-cleaner-checkpoint2 -storage/tokudb/ft-index/ft/tests/cachetable-cleaner-thread-attrs-accumulate -storage/tokudb/ft-index/ft/tests/cachetable-cleaner-thread-empty-cachetable -storage/tokudb/ft-index/ft/tests/cachetable-cleaner-thread-everything-pinned -storage/tokudb/ft-index/ft/tests/cachetable-cleaner-thread-nothing-needs-flushing -storage/tokudb/ft-index/ft/tests/cachetable-cleaner-thread-same-fullhash -storage/tokudb/ft-index/ft/tests/cachetable-cleaner-thread-simple -storage/tokudb/ft-index/ft/tests/cachetable-clock-all-pinned -storage/tokudb/ft-index/ft/tests/cachetable-clock-eviction -storage/tokudb/ft-index/ft/tests/cachetable-clock-eviction2 -storage/tokudb/ft-index/ft/tests/cachetable-clock-eviction3 -storage/tokudb/ft-index/ft/tests/cachetable-clock-eviction4 -storage/tokudb/ft-index/ft/tests/cachetable-clone-checkpoint -storage/tokudb/ft-index/ft/tests/cachetable-clone-partial-fetch -storage/tokudb/ft-index/ft/tests/cachetable-clone-partial-fetch-pinned-node -storage/tokudb/ft-index/ft/tests/cachetable-clone-pin-nonblocking -storage/tokudb/ft-index/ft/tests/cachetable-clone-unpin-remove -storage/tokudb/ft-index/ft/tests/cachetable-count-pinned-test -storage/tokudb/ft-index/ft/tests/cachetable-debug-test -storage/tokudb/ft-index/ft/tests/cachetable-eviction-close-test -storage/tokudb/ft-index/ft/tests/cachetable-eviction-close-test2 -storage/tokudb/ft-index/ft/tests/cachetable-eviction-getandpin-test -storage/tokudb/ft-index/ft/tests/cachetable-eviction-getandpin-test2 -storage/tokudb/ft-index/ft/tests/cachetable-evictor-class -storage/tokudb/ft-index/ft/tests/cachetable-fd-test -storage/tokudb/ft-index/ft/tests/cachetable-fetch-inducing-evictor -storage/tokudb/ft-index/ft/tests/cachetable-flush-during-cleaner -storage/tokudb/ft-index/ft/tests/cachetable-flush-test -storage/tokudb/ft-index/ft/tests/cachetable-getandpin-test -storage/tokudb/ft-index/ft/tests/cachetable-kibbutz_and_flush_cachefile -storage/tokudb/ft-index/ft/tests/cachetable-partial-fetch -storage/tokudb/ft-index/ft/tests/cachetable-pin-checkpoint -storage/tokudb/ft-index/ft/tests/cachetable-pin-nonblocking-checkpoint-clean -storage/tokudb/ft-index/ft/tests/cachetable-prefetch-checkpoint-test -storage/tokudb/ft-index/ft/tests/cachetable-prefetch-close-leak-test -storage/tokudb/ft-index/ft/tests/cachetable-prefetch-close-test -storage/tokudb/ft-index/ft/tests/cachetable-prefetch-flowcontrol-test -storage/tokudb/ft-index/ft/tests/cachetable-prefetch-getandpin-test -storage/tokudb/ft-index/ft/tests/cachetable-prefetch-maybegetandpin-test -storage/tokudb/ft-index/ft/tests/cachetable-prefetch2-test -storage/tokudb/ft-index/ft/tests/cachetable-put-checkpoint -storage/tokudb/ft-index/ft/tests/cachetable-put-test -storage/tokudb/ft-index/ft/tests/cachetable-rwlock-test -storage/tokudb/ft-index/ft/tests/cachetable-simple-clone -storage/tokudb/ft-index/ft/tests/cachetable-simple-clone2 -storage/tokudb/ft-index/ft/tests/cachetable-simple-maybe-get-pin -storage/tokudb/ft-index/ft/tests/cachetable-simple-pin -storage/tokudb/ft-index/ft/tests/cachetable-simple-pin-cheap -storage/tokudb/ft-index/ft/tests/cachetable-simple-pin-dep-nodes -storage/tokudb/ft-index/ft/tests/cachetable-simple-pin-nonblocking -storage/tokudb/ft-index/ft/tests/cachetable-simple-pin-nonblocking-cheap -storage/tokudb/ft-index/ft/tests/cachetable-simple-put-dep-nodes -storage/tokudb/ft-index/ft/tests/cachetable-simple-read-pin -storage/tokudb/ft-index/ft/tests/cachetable-simple-read-pin-nonblocking -storage/tokudb/ft-index/ft/tests/cachetable-simple-unpin-remove-checkpoint -storage/tokudb/ft-index/ft/tests/cachetable-simple-verify -storage/tokudb/ft-index/ft/tests/cachetable-test -storage/tokudb/ft-index/ft/tests/cachetable-unpin-and-remove-test -storage/tokudb/ft-index/ft/tests/cachetable-unpin-remove-and-checkpoint -storage/tokudb/ft-index/ft/tests/cachetable-unpin-test -storage/tokudb/ft-index/ft/tests/cachetable-writer-thread-limit -storage/tokudb/ft-index/ft/tests/comparator-test -storage/tokudb/ft-index/ft/tests/compress-test -storage/tokudb/ft-index/ft/tests/dbufio-test -storage/tokudb/ft-index/ft/tests/dbufio-test-destroy -storage/tokudb/ft-index/ft/tests/fifo-test -storage/tokudb/ft-index/ft/tests/ft-bfe-query -storage/tokudb/ft-index/ft/tests/ft-clock-test -storage/tokudb/ft-index/ft/tests/ft-serialize-benchmark -storage/tokudb/ft-index/ft/tests/ft-serialize-sub-block-test -storage/tokudb/ft-index/ft/tests/ft-serialize-test -storage/tokudb/ft-index/ft/tests/ft-test -storage/tokudb/ft-index/ft/tests/ft-test-cursor -storage/tokudb/ft-index/ft/tests/ft-test-cursor-2 -storage/tokudb/ft-index/ft/tests/ft-test-header -storage/tokudb/ft-index/ft/tests/ft-test0 -storage/tokudb/ft-index/ft/tests/ft-test1 -storage/tokudb/ft-index/ft/tests/ft-test2 -storage/tokudb/ft-index/ft/tests/ft-test3 -storage/tokudb/ft-index/ft/tests/ft-test4 -storage/tokudb/ft-index/ft/tests/ft-test5 -storage/tokudb/ft-index/ft/tests/ftloader-test -storage/tokudb/ft-index/ft/tests/ftloader-test-bad-generate -storage/tokudb/ft-index/ft/tests/ftloader-test-extractor -storage/tokudb/ft-index/ft/tests/ftloader-test-extractor-errors -storage/tokudb/ft-index/ft/tests/ftloader-test-merge-files-dbufio -storage/tokudb/ft-index/ft/tests/ftloader-test-open -storage/tokudb/ft-index/ft/tests/ftloader-test-vm -storage/tokudb/ft-index/ft/tests/ftloader-test-writer -storage/tokudb/ft-index/ft/tests/ftloader-test-writer-errors -storage/tokudb/ft-index/ft/tests/is_empty -storage/tokudb/ft-index/ft/tests/keyrange -storage/tokudb/ft-index/ft/tests/keytest -storage/tokudb/ft-index/ft/tests/le-cursor-provdel -storage/tokudb/ft-index/ft/tests/le-cursor-right -storage/tokudb/ft-index/ft/tests/le-cursor-walk -storage/tokudb/ft-index/ft/tests/list-test -storage/tokudb/ft-index/ft/tests/log-test -storage/tokudb/ft-index/ft/tests/log-test-maybe-trim -storage/tokudb/ft-index/ft/tests/log-test2 -storage/tokudb/ft-index/ft/tests/log-test3 -storage/tokudb/ft-index/ft/tests/log-test4 -storage/tokudb/ft-index/ft/tests/log-test5 -storage/tokudb/ft-index/ft/tests/log-test6 -storage/tokudb/ft-index/ft/tests/log-test7 -storage/tokudb/ft-index/ft/tests/logcursor-bad-checksum -storage/tokudb/ft-index/ft/tests/logcursor-empty-logdir -storage/tokudb/ft-index/ft/tests/logcursor-empty-logfile -storage/tokudb/ft-index/ft/tests/logcursor-empty-logfile-2 -storage/tokudb/ft-index/ft/tests/logcursor-empty-logfile-3 -storage/tokudb/ft-index/ft/tests/logcursor-print -storage/tokudb/ft-index/ft/tests/logcursor-timestamp -storage/tokudb/ft-index/ft/tests/logfilemgr-create-destroy -storage/tokudb/ft-index/ft/tests/logfilemgr-print -storage/tokudb/ft-index/ft/tests/make-tree -storage/tokudb/ft-index/ft/tests/minicron-test -storage/tokudb/ft-index/ft/tests/msnfilter -storage/tokudb/ft-index/ft/tests/omt-test -storage/tokudb/ft-index/ft/tests/orthopush-flush -storage/tokudb/ft-index/ft/tests/pqueue-test -storage/tokudb/ft-index/ft/tests/queue-test -storage/tokudb/ft-index/ft/tests/quicklz-test -storage/tokudb/ft-index/ft/tests/recovery-bad-last-entry -storage/tokudb/ft-index/ft/tests/recovery-cbegin -storage/tokudb/ft-index/ft/tests/recovery-cbegin-cend -storage/tokudb/ft-index/ft/tests/recovery-cbegin-cend-hello -storage/tokudb/ft-index/ft/tests/recovery-cend-cbegin -storage/tokudb/ft-index/ft/tests/recovery-datadir-is-file -storage/tokudb/ft-index/ft/tests/recovery-empty -storage/tokudb/ft-index/ft/tests/recovery-fopen-missing-file -storage/tokudb/ft-index/ft/tests/recovery-hello -storage/tokudb/ft-index/ft/tests/recovery-lsn-error-during-forward-scan -storage/tokudb/ft-index/ft/tests/recovery-no-datadir -storage/tokudb/ft-index/ft/tests/recovery-no-log -storage/tokudb/ft-index/ft/tests/recovery-no-logdir -storage/tokudb/ft-index/ft/tests/recovery-test5123 -storage/tokudb/ft-index/ft/tests/shortcut -storage/tokudb/ft-index/ft/tests/subblock-test-checksum -storage/tokudb/ft-index/ft/tests/subblock-test-compression -storage/tokudb/ft-index/ft/tests/subblock-test-index -storage/tokudb/ft-index/ft/tests/subblock-test-size -storage/tokudb/ft-index/ft/tests/test-assert -storage/tokudb/ft-index/ft/tests/test-bjm -storage/tokudb/ft-index/ft/tests/test-checkpoint-during-flush -storage/tokudb/ft-index/ft/tests/test-checkpoint-during-merge -storage/tokudb/ft-index/ft/tests/test-checkpoint-during-rebalance -storage/tokudb/ft-index/ft/tests/test-checkpoint-during-split -storage/tokudb/ft-index/ft/tests/test-del-inorder -storage/tokudb/ft-index/ft/tests/test-dirty-flushes-on-cleaner -storage/tokudb/ft-index/ft/tests/test-dump-ft -storage/tokudb/ft-index/ft/tests/test-flushes-on-cleaner -storage/tokudb/ft-index/ft/tests/test-ft-overflow -storage/tokudb/ft-index/ft/tests/test-hot-with-bounds -storage/tokudb/ft-index/ft/tests/test-inc-split -storage/tokudb/ft-index/ft/tests/test-leafentry-child-txn -storage/tokudb/ft-index/ft/tests/test-leafentry-nested -storage/tokudb/ft-index/ft/tests/test-merges-on-cleaner -storage/tokudb/ft-index/ft/tests/test-oldest-referenced-xid-flush -storage/tokudb/ft-index/ft/tests/test-pick-child-to-flush -storage/tokudb/ft-index/ft/tests/test-txn-child-manager -storage/tokudb/ft-index/ft/tests/test1308a -storage/tokudb/ft-index/ft/tests/test3681 -storage/tokudb/ft-index/ft/tests/test3856 -storage/tokudb/ft-index/ft/tests/test3884 -storage/tokudb/ft-index/ft/tests/test4115 -storage/tokudb/ft-index/ft/tests/test4244 -storage/tokudb/ft-index/ft/tests/test_block_allocator_merge -storage/tokudb/ft-index/ft/tests/test_logcursor -storage/tokudb/ft-index/ft/tests/test_oexcl -storage/tokudb/ft-index/ft/tests/test_toku_malloc_plain_free -storage/tokudb/ft-index/ft/tests/upgrade_test_simple -storage/tokudb/ft-index/ft/tests/verify-bad-msn -storage/tokudb/ft-index/ft/tests/verify-bad-pivots -storage/tokudb/ft-index/ft/tests/verify-dup-in-leaf -storage/tokudb/ft-index/ft/tests/verify-dup-pivots -storage/tokudb/ft-index/ft/tests/verify-misrouted-msgs -storage/tokudb/ft-index/ft/tests/verify-unsorted-leaf -storage/tokudb/ft-index/ft/tests/verify-unsorted-pivots -storage/tokudb/ft-index/ft/tests/x1764-test -storage/tokudb/ft-index/ft/tests/xid_lsn_independent -storage/tokudb/ft-index/ft/tests/ybt-test -storage/tokudb/ft-index/locktree/tests/concurrent_tree_create_destroy -storage/tokudb/ft-index/locktree/tests/concurrent_tree_lkr_acquire_release -storage/tokudb/ft-index/locktree/tests/concurrent_tree_lkr_insert_remove -storage/tokudb/ft-index/locktree/tests/concurrent_tree_lkr_insert_serial_large -storage/tokudb/ft-index/locktree/tests/concurrent_tree_lkr_remove_all -storage/tokudb/ft-index/locktree/tests/lock_request_create_set -storage/tokudb/ft-index/locktree/tests/lock_request_get_set_keys -storage/tokudb/ft-index/locktree/tests/lock_request_start_deadlock -storage/tokudb/ft-index/locktree/tests/lock_request_start_pending -storage/tokudb/ft-index/locktree/tests/locktree_conflicts -storage/tokudb/ft-index/locktree/tests/locktree_create_destroy -storage/tokudb/ft-index/locktree/tests/locktree_infinity -storage/tokudb/ft-index/locktree/tests/locktree_misc -storage/tokudb/ft-index/locktree/tests/locktree_overlapping_relock -storage/tokudb/ft-index/locktree/tests/locktree_simple_lock -storage/tokudb/ft-index/locktree/tests/locktree_single_txnid_optimization -storage/tokudb/ft-index/locktree/tests/manager_create_destroy -storage/tokudb/ft-index/locktree/tests/manager_locktree_map -storage/tokudb/ft-index/locktree/tests/manager_params -storage/tokudb/ft-index/locktree/tests/manager_reference_release_lt -storage/tokudb/ft-index/locktree/tests/manager_status -storage/tokudb/ft-index/locktree/tests/range_buffer_test -storage/tokudb/ft-index/locktree/tests/txnid_set_test -storage/tokudb/ft-index/locktree/tests/wfg_test -storage/tokudb/ft-index/portability/merge_archives_tokuportability_static.cmake -storage/tokudb/ft-index/portability/tokuportability_static_depends.cc -storage/tokudb/ft-index/portability/tests/test-active-cpus -storage/tokudb/ft-index/portability/tests/test-cache-line-boundary-fails -storage/tokudb/ft-index/portability/tests/test-cpu-freq -storage/tokudb/ft-index/portability/tests/test-cpu-freq-openlimit17 -storage/tokudb/ft-index/portability/tests/test-fair-rwlock -storage/tokudb/ft-index/portability/tests/test-filesystem-sizes -storage/tokudb/ft-index/portability/tests/test-flock -storage/tokudb/ft-index/portability/tests/test-fsync -storage/tokudb/ft-index/portability/tests/test-fsync-directory -storage/tokudb/ft-index/portability/tests/test-gettime -storage/tokudb/ft-index/portability/tests/test-gettimeofday -storage/tokudb/ft-index/portability/tests/test-hugepage -storage/tokudb/ft-index/portability/tests/test-max-data -storage/tokudb/ft-index/portability/tests/test-memory-status -storage/tokudb/ft-index/portability/tests/test-pagesize -storage/tokudb/ft-index/portability/tests/test-pthread-rwlock-rdlock -storage/tokudb/ft-index/portability/tests/test-pthread-rwlock-rwr -storage/tokudb/ft-index/portability/tests/test-pwrite4g -storage/tokudb/ft-index/portability/tests/test-snprintf -storage/tokudb/ft-index/portability/tests/test-stat -storage/tokudb/ft-index/portability/tests/test-toku-malloc -storage/tokudb/ft-index/portability/tests/test-xid -storage/tokudb/ft-index/portability/tests/try-assert-zero -storage/tokudb/ft-index/portability/tests/try-assert0 -storage/tokudb/ft-index/portability/tests/try-leak-lost -storage/tokudb/ft-index/portability/tests/try-leak-reachable -storage/tokudb/ft-index/portability/tests/try-uninit -storage/tokudb/ft-index/src/merge_archives_tokufractaltree_static.cmake -storage/tokudb/ft-index/src/tokufractaltree_static_depends.cc -storage/tokudb/ft-index/src/tests/recovery_fileops_unit_dir -storage/tokudb/ft-index/portability/toku_config.h -storage/tokudb/ft-index/util/tests/marked-omt-test -storage/tokudb/ft-index/util/tests/omt-tmpl-test -storage/tokudb/ft-index/util/tests/sort-tmpl-test -storage/tokudb/ft-index/util/tests/test-kibbutz -storage/tokudb/ft-index/util/tests/test-kibbutz2 -storage/tokudb/ft-index/util/tests/test-rwlock -storage/tokudb/ft-index/util/tests/test-rwlock-cheapness -storage/tokudb/ft-index/util/tests/test_circular_buffer -storage/tokudb/ft-index/util/tests/test_doubly_linked_list -storage/tokudb/ft-index/util/tests/test_partitioned_counter -storage/tokudb/ft-index/util/tests/test_partitioned_counter_5833 -storage/tokudb/ft-index/util/tests/threadpool-test -storage/tokudb/ft-index/util/tests/threadpool-testrunf -storage/tokudb/ft-index/tools/tokudb_dump -storage/tokudb/ft-index/tools/tokudb_gen -storage/tokudb/ft-index/tools/tokudb_load -storage/connect/connect.cnf -storage/cassandra/cassandra.cnf -libmysql/libmysql_versions.ld -scripts/mysql_config.pl -pcre/pcre_chartables.c -pcre/test*grep diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..cdfedef671f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +*.c diff=cpp +*.h diff=cpp +*.cc diff=cpp +*.ic diff=cpp +*.cpp diff=cpp diff --git a/.gitignore b/.gitignore index e283abf39f9..f7556f97c08 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ *.ninja .ninja_* .gdb_history +errmsg.sys +typescript CMakeCache.txt CMakeFiles/ CPackConfig.cmake @@ -21,6 +23,7 @@ Makefile TAGS Testing/ VERSION.dep +configure client/async_example client/mysql client/mysql_plugin @@ -72,6 +75,7 @@ mysql-test/mtr mysql-test/mysql-test-run mysql-test/var/ mysys/thr_lock +mysys/thr_timer packaging/rpm-oel/mysql.spec packaging/rpm-uln/mysql.10.0.11.spec packaging/solaris/postinstall-solaris @@ -103,6 +107,11 @@ scripts/mysqld_safe scripts/mysqldumpslow scripts/mysqlhotcopy scripts/mytop +scripts/wsrep_sst_common +scripts/wsrep_sst_mysqldump +scripts/wsrep_sst_rsync +scripts/wsrep_sst_xtrabackup +scripts/wsrep_sst_xtrabackup-v2 sql-bench/bench-count-distinct sql-bench/bench-init.pl sql-bench/compare-results @@ -131,7 +140,6 @@ sql/gen_lex_hash sql/lex_hash.h sql/mysql_tzinfo_to_sql sql/mysqld -sql/share/*/errmsg.sys sql/sql_builtin.cc sql/sql_yacc.cc sql/sql_yacc.h @@ -187,6 +195,7 @@ support-files/binary-configure support-files/config.huge.ini support-files/config.medium.ini support-files/config.small.ini +support-files/mariadb.pc support-files/my-huge.cnf support-files/my-innodb-heavy-4G.cnf support-files/my-large.cnf @@ -197,7 +206,8 @@ support-files/mysql.10.0.11.spec support-files/mysql.server support-files/mysql.spec support-files/mysqld_multi.server -support-files/ndb-config-2-node.ini +support-files/wsrep.cnf +support-files/wsrep_notify tags tests/async_queries tests/bug25714 diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index bde095b0aa8..a0fddfb2413 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -205,9 +205,8 @@ fi max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max" max_no_qc_configs="$SSL_LIBRARY --with-plugins=max --without-query-cache" -max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server --with-libevent" max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server --with-libevent" -all_configs="$SSL_LIBRARY --with-plugins=max --with-plugin-ndbcluster --with-embedded-server --with-innodb_plugin --with-libevent" +all_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server --with-innodb_plugin --with-libevent" # # CPU and platform specific compilation flags. @@ -215,7 +214,7 @@ all_configs="$SSL_LIBRARY --with-plugins=max --with-plugin-ndbcluster --with-emb alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag" amd64_cflags="$check_cpu_cflags" amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES" -pentium_cflags="$check_cpu_cflags" +pentium_cflags="$check_cpu_cflags -m32" pentium64_cflags="$check_cpu_cflags -m64" ppc_cflags="$check_cpu_cflags" sparc_cflags="" diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh deleted file mode 100755 index 78e5350dc1b..00000000000 --- a/BUILD/build_mccge.sh +++ /dev/null @@ -1,1876 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2008, 2010, Oracle. -# Copyright (c) 2009-2011 Monty Program Ab -# -# This program 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; version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# 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., 51 Franklin St, Fifth Floor, Boston, -# MA 02110-1301, USA - -die() -{ - echo "ERROR: $@"; exit 1; -} - -get_key_value() -{ - echo "$1" | sed 's/^--[a-zA-Z_-]*=//' -} - -developer_usage() -{ -cat < BUILD/build_mccge.sh - - This performs the following operations: - 1) Detects the operating system. Currently, Linux, FreeBSD, Solaris - 8/9/10/11, and Mac OS X are supported by this script. - 2) Detect the type of CPU being used. Currently supported processors - are: x86 for all supported operating systems, Itanium for Linux - with GCC, and x86 + SPARC for Solaris using the Forte compiler and - finally x86 on Linux using the Intel compiler. - 3) Invokes the GCC compiler. - 4) Builds a set of of binaries ; for more information about these, - see --extended-help. - 5) Default compiler is always gcc. - - The default version assumes that you have a source code tarball from - which you are building, and thus autoconf and automake do not need to - be run. If you have downloaded a launchpad tree then you should read - --developer-help. - - If your building on a Solaris SPARC machine and you want to compile - using SunStudio you must set - --compiler=forte; if you want to build using the Intel compiler on - Linux, you need to set --compiler=icc. If you want to use the AMD - compiler Open64 set --compiler=open64. - - A synonym for forte is SunStudio, so one can also use - --compiler=SunStudio. - - If you want to make sure that a 64-bit version is built then you - should add the flag --64. This is always set on Solaris machines and - when check-cpu is able to discover that a 64-bit CPU is being used. If - you want to ensure that a 32-bit binary is produced, use --32 instead. - - If you need the binaries to be installed in a different location from - /usr/local/mysql, then you should set --prefix to point to where you - want the binaries installed. - - Using a data directory other than the default (PREFIX/data) can be - done when starting the server, or by invoking this script with - the --datadir option. - - If you want your binaries stripped of surplus debug or other - information, use the --strip option. - - If you want debug information in the binary (for example, to be - able to send gdb core dumps to support), then you should add the - flag --with-debug; if you want a production build with only debugging - information in the binary then use --debug. -EOF -} - -usage() -{ -cat < x86 and 32-bit binary - x86_64 => x86 and 64 bit binary - --warning-mode=[extra|pedantic|normal|no] Set warning mode level - --warnings Set warning mode to normal - --32 Build a 32-bit binary even if CPU is 64-bit - --64 Build a 64-bit binary even if not sure a - 64-bit CPU is being used - --package=[pro|classic] Select package to build - --parallelism=number Define parallelism in make - --strip Strip binaries - --error-inject Enable error injection into MariaDB Server and - data nodes - --valgrind Build with valgrind - --fast Optimise for CPU architecture built on - --static-linking Statically link system libraries into binaries - --use-tcmalloc Link with tcmalloc instead of standard malloc (Linux only) - --with-flags * Pass extra --with-xxx options to configure -EOF - if test "x$1" != "x" ; then - echo "Failure Message: $1" - fi -} - -extended_usage() -{ - cat </bin (can be overridden) - - --localstatedir: /data, unless --datadir is used, in which - case it defaults to /data (can be overridden by setting - --localstatedir explicitly). - - --enable-local-infile: Enable use of the LOAD DATA FROM LOCAL INFILE - command (cannot be overridden). - - --enable-thread-safe-client: Enable the multi-threaded mysql client - library (cannot be overridden). - - --with-big-tables: Enable use of tables with more than 4G rows (cannot - be overridden). - - --with-extra-charsets=all: Enable use of all character sets supported - by MySQL (cannot be overridden). - - --with-ssl: Enable use of yaSSL library included in the MySQL source - if possible (GCC and same CC and CXX). - (cannot be overridden). - - --with-pic: Build all binaries using position independent assembler - to avoid problems with dynamic linkers (cannot be overridden). - - --without-example-engine: Ensure that the example engine isn't built, - it cannot do any useful things, it's merely intended as documentation. - (cannot be overridden) - - --with-csv-storage-engine: Ensure that the CSV storage engine is - included in all builds. Since CSV is required for log tables in - MySQL 5.1, this option cannot be overridden. - - (Note that MyISAM support is always built into the MySQL Server; the - server *cannot* be built without MyISAM.) - - --with-mysqld-ldflags=-static - --with-client-ldflags=-static - Ensures that binaries for, respectively, the MySQL server and client - are built with static libraries except for the system libraries, - which use dynamically loaded libraries provided by the operating - system. Building with --developer sets these to all-static instead, - to build everything statically. - - In addition there are some configure options that are specific to - Linux operating systems: - - --enable-assembler - Include assembler code optimisations for a number of mostly string - methods. Used for x86 processors only. - - Neither of the preceding options can be disabled. - - MySQL Cluster Carrier Grade edition also adds the following options - (also used by the extended package): - - --with-ndbcluster - Include the NDB Cluster storage engine, its kernel, management - server, and client, as well as support for the NDB and MGM APIs. - - --without-ndb-debug - Do not include specific NDB debug code, not even in debug versions - (cannot be overridden). - - Package-specific options: - ------------------------- - --with-innodb - Specifically included in the "pro" package. - - --with-comment - Sets the comment for the MySQL version, by package, as described - above. - - --with-server-suffix - Sets the server suffix on the MySQL version, by package, as - described above. - - Other options used: - ------------------- - --with-readline - Use the GPL readline library for command editing functions. - - --with-libedit - Use the BSD licensed library for command editing functions. - - --with-zlib-dir=bundled - Use the zlib package bundled with MySQL. - - --with-mysqld-libs=-lmtmalloc - Used on Solaris to ensure that the proper malloc library is used. - Investigations have shown mtmalloc to be the best choice on Solaris, - also umem has good performance on Solaris but better debugging - capabilities. - - Compiler options: - ----------------- - - This section describes the compiler options for each of the different - platforms supported by this script. - - The --fast option adds -mtune=cpu_arg to the C/C++ flags (provides - support for Nocona, K8, and other processors), this option is valid - when gcc is the compiler. - - Use of the --debug option adds -g to the C/C++ flags. - - In all cases it is possible to override the definition of CC and CXX - by calling the script as follows: - CC="/usr/local/bin/gcc" CXX="/usr/local/bin/gcc" BUILD/build_mccge.sh - - Feedback profiler on gcc - ------------------------ - Using gcc --generate-feedback=path causes the following flags to be added - to the compiler flags. - - --fprofile-generate - --fprofile-dir=path - - Using gcc with --use-feedback=path causes the following flags to be added - to the compiler flags. --fprofile-correction indicates MySQL is a multi- - threaded application and thus counters can be inconsistent with each other - and the compiler should take this into account. - - --fprofile-use - --fprofile-dir=path - --fprofile-correction - - Feedback compilation using Open64 - --------------------------------- - - Using Open64 with --generate-feedback=path causes the following flags to - be added to the compiler flags. - - -fb-create path/feedback - - Using Open64 with --use-feedback=path causes the following flags to be - added to the compiler flags. - - --fb-opt path/feedback - - Linux/x86+Itanium/gcc - ------------- - For debug builds -O is used and otherwise -O3 is used.Discovery of a - Nocona or Core 2 Duo CPU causes a 64-bit binary to be built; - otherwise, the binary is 32-bit. To build a 64-bit binary, -m64 is - added to the C/C++ flags. (To build a 32-bit binary on a 64-bit CPU, - use the --32 option as described previously.) - - When gcc 4.5 is used and the user set --with-link-time-optimizer then - also --flto is added to compiler flags and linker flags. - - Linux/x86+Itanium/icc - ------------- - Flags used: - CC = icc -static-libgcc -static-intel - C++ = icpc -static-libgcc -static-intel - C/C++ flags = -mp -restrict - - On Itanium we also add -no-ftz and to CC and C++ flags. - - Note that if the user of this script sets CC or CXX explicitly then - also -static-libgcc and -static-intel needs to be set in the CC and - CXX. - - The non-debug versions also add the following: - C/C++ flags += -O3 unroll2 -ip - - The fast version adds (if --with-link-time-optimizer is used): - C/C++ flags += -ipo - - On discovery of a Core 2 Duo architecture while using icc, -xT is also - added to the C/C++ flags; this provides optimisations specific to Core - 2 Duo. This is added only when the --fast flag is set. - - Linux/x86/Open64 - ---------------- - For normal builds use -O3, when fast flag is set one also adds - --march=auto to generate optimized builds for the CPU used. If - --with-link-time-optimizer is set also -ipa is set. There is also - a special flag --with-mso which can be set to get --mso set which - activates optimisation for multi-core scalability. - - FreeBSD/x86/gcc - --------------- - No flags are used. Instead, configure determines the proper flags to - use. - - Solaris/x86/gcc - --------------- - All builds on Solaris are by default 64-bit, so -m64 is always used in - the C/C++ flags. LDFLAGS is set to -m64 -O/-O2/-O3. If for - some reason a 32-bit Solaris is used it is necessary to add the flag - --32 to the script invocation. Due to bugs in compiling with -O3 on - Solaris only -O2 is used by default, when --fast flag is used -O3 will - be used instead. - - Sets -m64 (default) or -m32 (if specifically set) in LDFLAGS and - C/C++ flags. - - Solaris/Sparc/Forte - ------------------- - Uses cc as CC and CC as CXX - Note that SunStudio uses different binaries for C and C++ compilers. - - Set -m64 (default) or -m32 (if specifically set) in ASFLAGS, - LDFLAGS and C/C++ flags. - - Sets ASFLAGS=LDFLAGS=compiler flags=xarch=sparc, so that we compile - Sparc v9 binaries, also -mt is set in all those since we're always - building a multithreaded program. - - C flags = -xstrconst This flag is set only on SPARC - C++ flags = -noex - - Set the following C/C++ flags: - -fsimple=1 - -ftrap=%none - -nofstore This flag is set only on x86 - -xbuiltin=%all - -xlibmil - -xlibmopt - - Set the C++ flag: - -noex - -features=no%except This flag is set only on x86 - - When compiling with fast we set (-ipo only used if we have - set --with-link-time-optimizer): - C/C++ flags: -xtarget=native -xunroll=3 -xipo - LDFLAGS: -xipo - - When not compiling with fast we always set -xtarget=generic - - When compiling with fast on SPARC we also set: - C/C++ flags: -xbinopt=prepare - LDFLAGS: -xbinopt=prepare - - When compiling with fast on x86 we also set: - C/C++ flags: -xregs=frameptr - When not compiling with fast we set on x86 - C/C++ flags: -xregs=no%frameptr - - On SPARC we set - ASFLAGS = LDFLAGS = C/C++ flags = -xarch=sparc - - The optimisation level is - -xO Debug builds - -xO2 Production build on SPARC - -xO3 Production build on x86 - -xO4 Fast builds on SPARC/x86 - - MacOSX/x86/gcc - -------------- - C/C++ flags include -fno-common -arch i386. - When 64-bits builds then i386 is replaced by x86_64. - - Non-debug versions also add -Os -felide-constructors, where "-Os" - means the build is space-optimised as long as the space optimisations - do not negatively affect performance. Debug versions use -O. - - Mac OS X builds will always be 32-bit by default, when --64 is added - the build will be 64 bit instead. Thus the flag --m64 is added only - when specifically given as an option. -EOF -} - -with_usage() -{ - cat < /dev/null 2>&1 - then - make=gmake - else - make=make - fi - if test "x`$make --version | grep GNU`" = "x" ; then - die "Only gmake is supported" - fi -} - -# -# Find a libtoolize binary, both libtoolize and glibtoolize are -# ok, use first found. -# -set_libtoolize_version() -{ - LIBTOOLIZE=not_found - save_ifs="$IFS"; IFS=':' - for dir in $PATH - do - if test -x $dir/libtoolize - then - LIBTOOLIZE=libtoolize - echo "Found libtoolize in $dir" - break - fi - if test -x $dir/glibtoolize - then - LIBTOOLIZE=glibtoolize - echo "Found glibtoolize in $dir" - break - fi - done - IFS="$save_ifs" - if test "x$LIBTOOLIZE" = "xnot_found" ; then - die "Found no libtoolize version, quitting here" - fi - return -} - -# -# If ccache (a compiler cache which reduces build time) -# (http://samba.org/ccache) is installed, use it. -# We use 'grep' and hope that 'grep' works as expected -# (returns 0 if finds lines) -# We do not use ccache when gcov is used. Also only when -# gcc is used. -# -set_ccache_usage() -{ - if test "x$compiler" = "xgcc" ; then - if ccache -V > /dev/null 2>&1 && test "$USING_GCOV" != "1" - then - echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC" - echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX" - fi - fi -} - -# -# Set flags for various build configurations. -# Used in -valgrind builds -# -set_valgrind_flags() -{ - if test "x$valgrind_flag" = "xyes" ; then - loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify " - loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max" - compiler_flags="$compiler_flags $loc_valgrind_flags" - with_flags="$with_flags --with-valgrind" - fi -} - -# -# Set up warnings; default is to use no warnings, but if warning_mode -# is used a lot of warning flags are set up. These flags are valid only -# for gcc, so for other compilers we ignore the warning_mode. -# -set_warning_flags() -{ - if test "x$developer_flag" = "xyes" && test "x$warning_mode" = "x" ; then - warning_mode="normal" - fi - if test "x$compiler" = "xgcc" ; then - if test "x$warning_mode" = "normal" || test "x$warning_mode" = "extra" ; then -# Both C and C++ warnings - warnings="$warnings -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs" - warnings="$warnings -Wcomment -W" - warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare" - warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label" - warnings="$warnings -Wunused-value -Wunused-variable -Wno-uninitialized" - - if test "x$warning_mode" = "extra" ; then - warnings="$warnings -Wshadow" - fi -# C warnings - c_warnings="$warnings -Wunused-parameter" -# C++ warnings - cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder" - cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" - compiler_flags="$compiler_flags -Wuninitialized" - elif test "x$warning_mode" = "xpedantic" ; then - warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE" - c_warnings="$warnings" - cxx_warnings="$warnings -std=c++98" -# Reset CPU flags (-mtune), they don't work in -pedantic mode - check_cpu_cflags="" - fi - fi -} - -# -# Used in -debug builds -# -set_with_debug_flags() -{ - if test "x$with_debug_flag" = "xyes" ; then - if test "x$developer_flag" = "xyes" ; then - loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG" - loc_debug_flags="$loc_debug_flags -Wuninitialized -DFORCE_INIT_OF_VARS" - loc_debug_flags="$loc_debug_flags -DSAFEMALLOC" - compiler_flags="$compiler_flags $loc_debug_flags" - fi - compiler_flags="$compiler_flags $extra_debug_flags" - fi -} - -# -# Flag for optimizing builds for developers. -# -set_no_omit_frame_pointer_for_developers() -{ - if test "x$fast_flag" != "xno" ; then - if test "x$developer_flag" = "xyes" && test "x$compiler" = "xgcc" ; then -# Be as fast as we can be without losing our ability to backtrace. - compiler_flags="$compiler_flags -fno-omit-frame-pointer" - fi - fi -} - -# -# Add -g to all builds that requested debug information in build -# -set_debug_flag() -{ - if test "x$compile_debug_flag" = "xyes" ; then - compiler_flags="$compiler_flags -g" - fi -} - -# -# We compile in SSL support if we can, this isn't possible if CXX -# and CC aren't the same and we're not using GCC. -# -set_ssl() -{ - if test "x$compiler" = "xgcc" && \ - test "x$CC" = "x$CXX" ; then - base_configs="$base_configs --with-ssl" - fi -} - -# -# Base options used by all packages -# -# SSL library to use. --with-ssl selects the bundled yaSSL -# implementation of SSL. To use openSSL, you must point out the location -# of the openSSL headers and libs on your system. -# For example: --with-ssl=/usr -# -set_base_configs() -{ - base_configs="$base_configs --prefix=$prefix" - base_configs="$base_configs --libexecdir=$prefix/bin" - base_configs="$base_configs --with-zlib-dir=bundled" - if test "x$datadir" = "x" ; then - base_configs="$base_configs --localstatedir=$prefix/data" - else - base_configs="$base_configs --localstatedir=$datadir" - fi - if test "x$with_debug_flag" = "xyes" ; then - base_configs="$base_configs --with-debug" - fi - base_configs="$base_configs --enable-local-infile" - base_configs="$base_configs --enable-thread-safe-client" - base_configs="$base_configs --with-big-tables" - base_configs="$base_configs --with-extra-charsets=all" - if test "x$with_fast_mutexes" = "xyes" ; then - base_configs="$base_configs --with-fast-mutexes" - fi - base_configs="$base_configs --with-pic" - base_configs="$base_configs --with-csv-storage-engine" - if test "x$with_perfschema" != "xno" ; then - base_configs="$base_configs --with-perfschema" - fi - base_configs="$base_configs --with-libevent" -} - -# -# Add all standard engines and partitioning -# -set_max_engines() -{ - engine_configs="--with-plugins=max --with-plugin-maria --with-maria-tmp-tables" - engine_configs="$engine_configs --without-plugin-innodb_plugin" - base_configs="$base_configs $engine_configs" -} - -set_ndb_engine() -{ - base_configs="$base_configs --with-ndbcluster" - base_configs="$base_configs --without-ndb-debug" -} - -set_pro_package() -{ - if test "x$without_comment" != "xyes" ; then - base_configs="$base_configs --with-comment=\"Pro $version_text built from source\"" - fi - if test "x$with_debug_flag" = "xyes" ; then - base_configs="$base_configs --with-server-suffix=\"-debug\"" - fi -} - -set_classic_package() -{ - if test "x$without_comment" != "xyes" ; then - base_configs="$base_configs --with-comment=\"Classic $version_text built from source\"" - fi - if test "x$with_debug_flag" = "xyes" ; then - base_configs="$base_configs --with-server-suffix=\"-debug\"" - fi - base_configs="$base_configs --without-example-storage-engine" -} - -# -# Special handling of readline; use readline from the MySQL -# distribution if building a GPL version, otherwise use libedit. -# -set_readline_package() -{ - if test -d "$path/../cmd-line-utils/readline" && test "x$gpl" = "xyes" ; then - base_configs="$base_configs --with-readline" - elif test -d "$path/../cmd-line-utils/libedit" ; then - base_configs="$base_configs --with-libedit" - fi -} - -# -# If fast flag set by user we also add architecture as discovered to -# compiler flags to make binary optimised for architecture at hand. -# We use this feature on gcc compilers. -# -set_gcc_special_options() -{ - if test "x$fast_flag" = "xyes" && test "x$compiler" = "xgcc" ; then - compiler_flags="$compiler_flags $check_cpu_cflags" - fi -} - -# -# If we discover a Core 2 Duo architecture and we have enabled the fast -# flag, we enable a compile especially optimised for Core 2 Duo. This -# feature is currently available on Intel's icc compiler only. -# -set_icc_special_options() -{ - if test "x$fast_flag" = "xyes" && test "x$cpu_arg" = "xcore2" && \ - test "x$compiler" = "xicc" ; then - compiler_flags="$compiler_flags -xT" - fi -} - -set_cc_and_cxx_for_gcc() -{ - if test "x$CC" = "x" ; then - CC="gcc -static-libgcc -fno-exceptions" - fi - if test "x$CXX" = "x" ; then - CXX="gcc -static-libgcc -fno-exceptions" - fi -} - -set_cc_and_cxx_for_icc() -{ - if test "x$CC" = "x" ; then - CC="icc -static-intel -static-libgcc" - fi - if test "x$CXX" = "x" ; then - CXX="icpc -static-intel -static-libgcc" - fi -} - -set_cc_and_cxx_for_open64() -{ - if test "x$CC" = "x" ; then - CC="opencc -static-libgcc -fno-exceptions" - fi - if test "x$CXX" = "x" ; then - CXX="openCC -static-libgcc -fno-exceptions" - fi -} - -set_cc_and_cxx_for_forte() -{ - if test "x$CC" = "x" ; then - CC="cc" - fi - if test "x$CXX" = "x" ; then - CXX="CC" - fi -} - -# -# FreeBSD Section -# -set_bsd_configs() -{ - if test "x$cpu_base_type" != "xx86" ; then - usage "Only x86 CPUs supported for FreeBSD" - exit 1 - fi - if test "x$compiler" != "xgcc" ; then - usage "Only gcc supported for FreeBSD" - exit 1 - fi - base_configs="$base_configs --enable-assembler" - if test "x$fast_flag" != "xno" ; then - compiler_flags="$compiler_flags -O3" - else - compiler_flags="$compiler_flags -O0" - fi - set_cc_and_cxx_for_gcc -} - -check_64_bits() -{ - echo "Checking for 32/64-bits compilation" - echo "int main() { return 0; }" > temp_test.c - if test "x$m64" = "xyes" ; then - cmd="$CC $compile_flags -m64 temp_test.c" - if ! $cmd 2>1 ; then - m64="no" - echo "Changing to 32-bits since 64-bits didn't work" - else - echo "Will use 64-bits" - fi - else - cmd="$CC $compile_flags -m32 temp_test.c" - if ! $cmd 2>1 ; then - m64="yes" - echo "Changing to 64-bits since 32-bits didn't work" - else - echo "Will use 32-bits" - fi - fi - rm temp_test.c -} - -# -# Get GCC version -# -get_gcc_version() -{ - # check if compiler is gcc and dump its version - cc_verno=`$cc -dumpversion 2>/dev/null` - if test "x$?" = "x0" ; then - set -- `echo $cc_verno | tr '.' ' '` - cc_ver="GCC" - cc_major=$1 - cc_minor=$2 - cc_patch=$3 - gcc_version=`expr $cc_major '*' 100 '+' $cc_minor` - fi -} - -# -# Link time optimizer (interprocedural optimizations) for Open64 -# -check_for_open64_link_time_optimizer() -{ - if test "x$with_link_time_optimizer" = "xyes" ; then - compiler_flags="$compiler_flags -ipa" - LDFLAGS="$LDFLAGS -ipa" - fi -} - -# -# Link time optimizer (interprocedural optimizations) for icc -# -check_for_icc_link_time_optimizer() -{ - if test "x$with_link_time_optimizer" = "xyes" ; then - compiler_flags="$compiler_flags -ipo" - LDFLAGS="$LDFLAGS -ipo" - fi -} - -# -# Link time optimizer (interprocedural optimizations) for forte -# -check_for_forte_link_time_optimizer() -{ - if test "x$with_link_time_optimizer" = "xyes" ; then - compiler_flags="$compiler_flags -ipo" - LDFLAGS="$LDFLAGS -ipo" - fi -} - -# -# Link Time Optimizer in GCC (LTO) uses a parameter -flto -# which was added to GCC 4.5, if --with-link-time-optimizer -# is set then use this feature -# -check_for_gcc_link_time_optimizer() -{ - get_gcc_version - if test "$gcc_version" -ge 405 && \ - test "x$with_link_time_optimizer" = "xyes" ; then - compiler_flags="$compiler_flags -flto" - LDFLAGS="$LDFLAGS -flto" - fi -} - -set_feedback_for_gcc() -{ - if test "x$GENERATE_FEEDBACK_PATH" != "x" ; then - compiler_flags="$compiler_flags -fprofile-generate" - compiler_flags="$compiler_flags -fprofile-dir=$GENERATE_FEEDBACK_PATH" - elif test "x$USE_FEEDBACK_PATH" != "x" ; then - compiler_flags="$compiler_flags -fprofile-use" - compiler_flags="$compiler_flags -fprofile-correction" - compiler_flags="$compiler_flags -fprofile-dir=$USE_FEEDBACK_PATH" - fi -} - -set_feedback_for_open64() -{ - if test "x$GENERATE_FEEDBACK_PATH" != "x" ; then - compiler_flags="$compiler_flags --fb-create=$GENERATE_FEEDBACK_PATH/feedback" - elif test "x$USE_FEEDBACK_PATH" != "x" ; then - compiler_flags="$compiler_flags --fb-opt=$USE_FEEDBACK_PATH/feedback" - fi -} - -# -# Linux Section -# -set_linux_configs() -{ -# Default to use --with-fast-mutexes on Linux - if test "x$with_fast_mutexes" = "x" ; then - base_configs="$base_configs --with-fast-mutexes" - fi - if test "x$cpu_base_type" != "xx86" && \ - test "x$cpu_base_type" != "xitanium" ; then - usage "Only x86 and Itanium CPUs supported for Linux" - exit 1 - fi - if test "x$use_tcmalloc" = "xyes" ; then - base_configs="$base_configs --with-mysqld-libs=-ltcmalloc_minimal" - fi - if test "x$cpu_base_type" = "xx86" ; then - base_configs="$base_configs --enable-assembler" - fi - if test "x$compiler" = "xgcc" ; then - set_cc_and_cxx_for_gcc - if test "x$fast_flag" != "xno" ; then - if test "x$fast_flag" = "xyes" ; then - compiler_flags="$compiler_flags -O3" - check_for_gcc_link_time_optimizer - else - compiler_flags="$compiler_flags -O3" - fi - else - compiler_flags="$compiler_flags -O0" - fi - set_feedback_for_gcc -# configure will set proper compiler flags for gcc on Linux - elif test "x$compiler" = "xicc" ; then - compiler_flags="$compiler_flags -mp -restrict" - set_cc_and_cxx_for_icc - if test "x$cpu_base_type" = "xitanium" ; then - compiler_flags="$compiler_flags -no-ftz" - fi - if test "x$fast_flag" != "xno" ; then - compiler_flags="$compiler_flags -O3 -unroll2 -ip" - if test "x$fast_flag" = "xyes" ; then - check_for_icc_link_time_optimizer - fi - fi - elif test "x$compiler" = "xopen64" ; then - set_cc_and_cxx_for_open64 - if test "x$fast_flag" != "xno" ; then - if test "x$fast_flag" = "xyes" ; then - compiler_flags="$compiler_flags -O3" -# Generate code specific for the machine you run on - compiler_flags="$compiler_flags -march=auto" - check_for_open64_link_time_optimizer - if test "x$with_mso" = "xyes" ; then - compiler_flags="$compiler_flags -mso" - fi - else - compiler_flags="$compiler_flags -O3" - fi - fi - set_feedback_for_open64 - else - usage "Only gcc,icc and Open64 compilers supported for Linux" - exit 1 - fi - check_64_bits - if test "x$m64" = "xyes" ; then - compiler_flags="$compiler_flags -m64" - else - compiler_flags="$compiler_flags -m32" - fi -} - -# -# Solaris Section -# -set_solaris_configs() -{ -# Use mtmalloc as malloc, see Tim Cook blog -# For information on optimal compiler settings, see article at -# http://developers.sun.com/solaris/articles/mysql_perf_tune.html -# by Luojia Chen at Sun. - base_configs="$base_configs --with-named-curses=-lcurses" - case "`uname -a`" in - *5.8* | *5.9* ) - ;; - - *5.10* | *5.11*) - base_configs="$base_configs --with-mysqld-libs=-lmtmalloc" - ;; - *) - usage "Only versions 8,9, 10 and 11 supported for Solaris" - exit 1 - esac - if test "x$cpu_base_type" != "xx86" && \ - test "x$cpu_base_type" != "xsparc" ; then - usage "Only x86 and Sparc CPUs supported for Solaris" - exit 1 - fi - if test "x$compiler" != "xgcc" && \ - test "x$compiler" != "xforte" ; then - usage "Only gcc and Forte compilers supported for Solaris" - exit 1 - fi - if test "x$m64" = "xyes" ; then - compiler_flags="$compiler_flags -m64" - LDFLAGS="-m64" - ASFLAGS="$ASFLAGS -m64" - else - compiler_flags="$compiler_flags -m32" - LDFLAGS="-m32" - ASFLAGS="$ASFLAGS -m32" - fi - if test "x$compiler" = "xgcc" ; then - set_cc_and_cxx_for_gcc - if test "x$cpu_base_type" != "xx86" ; then - usage "gcc currently not supported for Solaris on SPARC" - exit 1 - fi - if test "x$fast_flag" = "xyes" ; then - LDFLAGS="$LDFLAGS -O3" - compiler_flags="$compiler_flags -O3" - check_for_gcc_link_time_optimizer - else - if test "x$fast_flag" = "xgeneric" ; then - LDFLAGS="$LDFLAGS -O2" - compiler_flags="$compiler_flags -O2" - else - LDFLAGS="$LDFLAGS -O0" - compiler_flags="$compiler_flags -O0" - fi - fi - else -#Using Forte compiler (SunStudio) - set_cc_and_cxx_for_forte - compiler_flags="$compiler_flags -mt" - LDFLAGS="$LDFLAGS -mt" - compiler_flags="$compiler_flags -fsimple=1" - compiler_flags="$compiler_flags -ftrap=%none" - compiler_flags="$compiler_flags -xbuiltin=%all" - compiler_flags="$compiler_flags -xlibmil" - compiler_flags="$compiler_flags -xlibmopt" - if test "x$fast_flag" = "xyes" ; then - compiler_flags="$compiler_flags -xtarget=native" - compiler_flags="$compiler_flags -xunroll=3" - check_for_forte_link_time_optimizer - else - compiler_flags="$compiler_flags -xtarget=generic" - fi - if test "x$cpu_base_type" = "xx86" ; then - compiler_flags="$compiler_flags -nofstore" - base_cxx_flags="$base_cxx_flags -features=no%except" - if test "x$fast_flag" = "xyes" ; then - compiler_flags="$compiler_flags -xregs=frameptr" - compiler_flags="$compiler_flags -xO4" - else - compiler_flags="$compiler_flags -xregs=no%frameptr" - if test "x$fast_flag" = "xgeneric" ; then - compiler_flags="$compiler_flags -xO2" - else - compiler_flags="$compiler_flags -xO0" - fi - fi - else -#Using SPARC cpu with SunStudio (Forte) compiler - ASFLAGS="$ASFLAGS -xarch=sparc" - LDFLAGS="$LDFLAGS -xarch=sparc" - base_cxxflags="$base_cxxflags -noex" - base_cflags="$base_cflags -xstrconst" - compiler_flags="$compiler_flags -xarch=sparc" - if test "x$fast_flag" = "xyes" ; then - compiler_flags="$compiler_flags -xbinopt=prepare" - LDFLAGS="$LDFLAGS -xbinopt=prepare" - compiler_flags="$compiler_flags -xO4" - elif test "x$fast_flag" = "xgeneric" ; then - compiler_flags="$compiler_flags -xO3" - else - compiler_flags="$compiler_flags -xO0" - fi - fi - fi -} - -# -# Mac OS X Section -# -set_macosx_configs() -{ - if test "x$cpu_base_type" != "xx86" || test "x$compiler" != "xgcc" ; then - usage "Only gcc/x86 supported for Mac OS X" - exit 1 - fi -# -# Optimize for space as long as it doesn't affect performance, use some -# optimisations also when not in fast mode. -# - base_cxxflags="$base_cxxflags -felide-constructors" - compiler_flags="$compiler_flags -fno-common" - if test "x$m64" = "xyes" ; then - compiler_flags="$compiler_flags -m64" - compiler_flags="$compiler_flags -arch x86_64" - else - compiler_flags="$compiler_flags -m32" - compiler_flags="$compiler_flags -arch i386" - fi - if test "x$fast_flag" != "xno" ; then - compiler_flags="$compiler_flags -Os" - else - compiler_flags="$compiler_flags -O0" - fi - set_cc_and_cxx_for_gcc -} - -# -# Use static linking for own modules and dynamic linking for system -# modules unless specifically requested to do everything statically. -# Should normally not be used; static_linking_flag kept in case someone -# really needs it. Available only if developer flag is also set. -# -set_static_link_configs() -{ - if test "x$static_linking_flag" = "xyes" && test "x$developer_flag" = "xyes" ; then - loc_static_link="--with-mysqld-ldflags=\"-all-static\"" - loc_static_link="$loc_static_link --with-client-ldflags=\"-all-static\"" - else - loc_static_link="--with-mysqld-ldflags=\"-static\"" - loc_static_link="$loc_static_link --with-client-ldflags=\"-static\"" - fi - base_configs="$base_configs $loc_static_link" -} - -# -# Enable error injection in MySQL Server (for developer build only - -# extra check for developer flag required). -# -set_error_inject_configs() -{ - if test "x$error_inject_flag" = "xyes" && test "x$developer_flag" = "xyes" ; then - base_configs="$base_configs --with-error-inject" - if test "x$package" = "xndb" || test "x$package" = "xextended" ; then - base_configs="$base_configs --with-ndb-ccflags='-DERROR_INSERT'" - fi - fi -} - -set_default_package() -{ - if test "x$package" = "x" ; then - package="extended" - fi -} - -set_defaults_based_on_environment() -{ - if test ! -z "$MYSQL_DEVELOPER" ; then - developer_flag="yes" - fi - if test ! -z "$MYSQL_DEVELOPER_DEBUG" ; then - with_debug_flag="yes" - fast_flag="no" - fi - if test ! -z "$MYSQL_DEVELOPER_PACKAGE" ; then - package="$MYSQL_DEVELOPER_PACKAGE" - parse_package - fi -} - -######################################################################## - -if test ! -f sql/mysqld.cc ; then - die "You must run this script from the MySQL top-level directory" -fi - -cpu_type= -package= -prefix="/usr/local/mysql" -parallelism="8" -fast_flag="generic" -compiler="gcc" -gpl="yes" -version_text= -developer_flag="no" -just_configure= -warning_mode= -with_flags= -error_inject_flag= -with_debug_flag= -compile_debug_flag= -strip_flag= -valgrind_flag= -static_linking_flag= -compiler_flags= -os= -cpu_base_type= -warnings= -c_warnings= -cflags= -base_cflags= -cxx_warnings= -base_cxxflags= -base_configs= -debug_flags= -cxxflags= -extra_debug_flags= -m64= -explicit_size_set= -datadir= -commands= -engine_configs= -ASFLAGS= -LDFLAGS= -use_tcmalloc= -without_comment="yes" -with_fast_mutexes= -with_perfschema="yes" -with_link_time_optimizer= -with_mso= -gcc_version="0" -generate_feedback_path= -use_feedback_path= - -set_defaults_based_on_environment - -parse_options "$@" - -set_default_package - -set -e - -# -# Check for the CPU and set up CPU specific flags. We may reset them -# later. -# This call sets the cpu_arg and check_cpu_args parameters -# -path=`dirname $0` -if test "x$compiler" = "xgcc" ; then - compiler= -fi -. "$path/check-cpu" -if test "x$compiler" = "x" ; then - compiler="gcc" -fi -check_os -set_cpu_base -if test "x$?" = "x1" ; then - exit 1 -fi - -# -# Set up c_warnings and cxx_warnings; add to compiler_flags. -# Possibly reset check_cpu_flags. -# -set_warning_flags - -# -# Add to compiler_flags. -# -set_valgrind_flags -set_with_debug_flags -set_no_omit_frame_pointer_for_developers -set_debug_flag -set_gcc_special_options -set_icc_special_options - -# -# Definitions of various packages possible to compile. The default is to -# build a source variant including all storage engines except InnoDB. -# -set_base_configs - version_text="GPL version" -if test "x$package" = "xpro" ; then - set_max_engines - set_pro_package -elif test "x$package" = "xclassic" ; then - set_classic_package -else - die "No supported package was used, internal error" -fi -set_readline_package -set_static_link_configs -set_error_inject_configs - -# -# This section handles flags for specific combinations of compilers, -# operating systems, and processors. -# - -if test "x$os" = "xlinux" ; then - set_linux_configs -elif test "x$os" = "xSolaris" ; then - set_solaris_configs -elif test "x$os" = "xMacOSX" ; then - set_macosx_configs -elif test "x$os" = "xbsd" ; then - set_bsd_configs -else - die "Operating system not supported by this script" -fi -set_ssl -# -# Final step before setting up commands is to set up proper make and -# proper libtoolize versions, and to determine whether to use ccache. -# -set_make_version -set_ccache_usage - -# -# Set up commands variable from variables prepared for base -# configurations, compiler flags, and warnings flags. -# -init_configure_commands - -if test "x$just_configure" != "xyes" ; then - add_make_commands -fi - -# -# The commands variable now contains the entire command to be run for -# the build; we either execute it, or merely print it out. -# -echo "Running command:" -echo "$commands" -if test "x$just_print" != "xyes" ; then - eval "set -x; $commands" -fi diff --git a/BUILD/compile-amd64-debug-max-no-ndb b/BUILD/compile-amd64-debug-max-no-ndb index 100a17163a4..d45a51eba54 100755 --- a/BUILD/compile-amd64-debug-max-no-ndb +++ b/BUILD/compile-amd64-debug-max-no-ndb @@ -20,6 +20,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$amd64_cflags $debug_cflags" -extra_configs="$amd64_configs $debug_configs $max_no_ndb_configs" +extra_configs="$amd64_configs $debug_configs $max_configs" . "$path/FINISH.sh" diff --git a/BUILD/compile-amd64-debug-wsrep b/BUILD/compile-amd64-debug-wsrep new file mode 100644 index 00000000000..995a8afcca9 --- /dev/null +++ b/BUILD/compile-amd64-debug-wsrep @@ -0,0 +1,11 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$amd64_cflags $debug_cflags -g -O0 $wsrep_cflags" +c_warnings="$c_warnings $debug_extra_warnings" +cxx_warnings="$cxx_warnings $debug_extra_warnings" +extra_configs="$amd64_configs $debug_configs $wsrep_configs --with-wsrep" + +. "$path/FINISH.sh" diff --git a/BUILD/compile-amd64-gprof-no-ndb b/BUILD/compile-amd64-gprof-no-ndb index 9fd4c67155c..ef684274658 100755 --- a/BUILD/compile-amd64-gprof-no-ndb +++ b/BUILD/compile-amd64-gprof-no-ndb @@ -2,6 +2,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$amd64_cflags -pg -g" -extra_configs="$amd64_configs $max_no_ndb_configs --disable-shared $static_link" +extra_configs="$amd64_configs $max_configs --disable-shared $static_link" . "$path/FINISH.sh" diff --git a/BUILD/compile-amd64-max-sci b/BUILD/compile-amd64-max-sci deleted file mode 100644 index fbcbba7920b..00000000000 --- a/BUILD/compile-amd64-max-sci +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -# Copyright (C) 2007 MySQL AB -# Use is subject to license terms -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -path=`dirname $0` -. "$path/SETUP.sh" -extra_flags="$amd64_cflags $fast_cflags -g" -extra_configs="$amd64_configs $max_configs --with-ndb-sci=/opt/DIS" - -. "$path/FINISH.sh" diff --git a/BUILD/compile-amd64-wsrep b/BUILD/compile-amd64-wsrep new file mode 100644 index 00000000000..57dfbdd6da2 --- /dev/null +++ b/BUILD/compile-amd64-wsrep @@ -0,0 +1,9 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$amd64_cflags $fast_cflags -g $wsrep_cflags" +extra_configs="$amd64_configs $wsrep_configs --with-wsrep" + +. "$path/FINISH.sh" diff --git a/BUILD/compile-bintar b/BUILD/compile-bintar index 2b039e439c0..8434bf57a52 100755 --- a/BUILD/compile-bintar +++ b/BUILD/compile-bintar @@ -73,7 +73,7 @@ CC="gcc -static-libgcc" CXX="g++ -static-libgcc" CFLAGS="$FLAGS" CXXFLAGS="$FLAG --without-docs --with-extra-charsets=all \ --with-libwrap --with-ssl --with-readline --with-libevent --with-zlib-dir=bundled \ --with-partition --with-embedded-server \ - --with-plugins=max-no-ndb \ + --with-plugins=max \ --without-plugin-innodb_plugin make $AM_MAKEFLAGS diff --git a/BUILD/compile-dist b/BUILD/compile-dist index becfea638f8..853fd339769 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -78,5 +78,5 @@ fi ./configure \ --with-embedded-server \ --with-perfschema \ - --with-plugins=max-no-ndb + --with-plugins=max $gmake -j4 diff --git a/BUILD/compile-ndb-autotest b/BUILD/compile-ndb-autotest deleted file mode 100755 index 691b309fb60..00000000000 --- a/BUILD/compile-ndb-autotest +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh - -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_configs="$max_configs --with-ndb-test --with-ndb-ccflags='-DERROR_INSERT'" -extra_flags="$fast_cflags $max_cflags -g" - -. "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-max-no-ndb b/BUILD/compile-pentium-debug-max-no-ndb index fa8069414b2..705164c20bc 100755 --- a/BUILD/compile-pentium-debug-max-no-ndb +++ b/BUILD/compile-pentium-debug-max-no-ndb @@ -19,6 +19,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs $max_no_ndb_configs" +extra_configs="$pentium_configs $debug_configs $max_configs" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-debug-wsrep b/BUILD/compile-pentium-debug-wsrep new file mode 100644 index 00000000000..ee68e3fd0c1 --- /dev/null +++ b/BUILD/compile-pentium-debug-wsrep @@ -0,0 +1,12 @@ +#! /bin/sh -x + +path=`dirname $0` +set -- "$@" --with-debug=full +. "$path/SETUP.sh" + +extra_flags="$pentium_cflags $debug_cflags -g -O0 $wsrep_cflags" +c_warnings="$c_warnings $debug_extra_warnings" +cxx_warnings="$cxx_warnings $debug_extra_warnings" +extra_configs="$pentium_configs $debug_configs $wsrep_configs --with-wsrep" + +. "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-valgrind-max-no-ndb b/BUILD/compile-pentium-valgrind-max-no-ndb index c3ebb47cc22..4eb47cb2fe2 100755 --- a/BUILD/compile-pentium-valgrind-max-no-ndb +++ b/BUILD/compile-pentium-valgrind-max-no-ndb @@ -21,6 +21,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$pentium_cflags $debug_cflags $valgrind_flags" -extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs" +extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs" . "$path/FINISH.sh" diff --git a/BUILD/compile-pentium-wsrep b/BUILD/compile-pentium-wsrep new file mode 100644 index 00000000000..eeb14310e4e --- /dev/null +++ b/BUILD/compile-pentium-wsrep @@ -0,0 +1,11 @@ +#! /bin/sh + +path=`dirname $0` +. "$path/SETUP.sh" + +extra_flags="$pentium_cflags $fast_cflags $wsrep_cflags" +extra_configs="$pentium_configs $wsrep_configs --with-wsrep" + +#strip=yes + +. "$path/FINISH.sh" diff --git a/BUILD/compile-pentium64-max-sci b/BUILD/compile-pentium64-max-sci deleted file mode 100644 index a19351308c5..00000000000 --- a/BUILD/compile-pentium64-max-sci +++ /dev/null @@ -1,25 +0,0 @@ -#! /bin/sh - -# Copyright (C) 2007 MySQL AB -# Use is subject to license terms -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -path=`dirname $0` -. "$path/SETUP.sh" - -extra_flags="$pentium64_cflags $fast_cflags -g" -extra_configs="$pentium_configs $max_configs --with-ndb-sci=/opt/DIS" - -. "$path/FINISH.sh" diff --git a/storage/ndb/test/run-test/atrt-gather-result.sh b/BUILD/compile-pentium64-wsrep old mode 100755 new mode 100644 similarity index 62% rename from storage/ndb/test/run-test/atrt-gather-result.sh rename to BUILD/compile-pentium64-wsrep index acc58bcbca3..0bccb34e753 --- a/storage/ndb/test/run-test/atrt-gather-result.sh +++ b/BUILD/compile-pentium64-wsrep @@ -1,7 +1,6 @@ -#!/bin/sh +#! /bin/sh -# Copyright (c) 2004, 2005, 2007 MySQL AB -# Use is subject to license terms +# Copyright (C) 2006, 2007 MySQL AB # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -15,20 +14,15 @@ # # 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., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA - -set -e - -mkdir -p result -cd result -rm -rf * - -while [ $# -gt 0 ] -do - rsync -a --exclude='BACKUP' --exclude='ndb_*_fs' "$1" . - shift -done +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA +path=`dirname $0` +. "$path/SETUP.sh" +extra_flags="$pentium64_cflags $fast_cflags -g $wsrep_cflags" +extra_configs="$pentium_configs $static_link $wsrep_configs --with-wsrep" +CC="$CC --pipe" +strip=yes +. "$path/FINISH.sh" diff --git a/BUILD/compile-ppc-debug-max-no-ndb b/BUILD/compile-ppc-debug-max-no-ndb index ba7fe9aee5b..0642ddf7a57 100755 --- a/BUILD/compile-ppc-debug-max-no-ndb +++ b/BUILD/compile-ppc-debug-max-no-ndb @@ -20,6 +20,6 @@ path=`dirname $0` . "$path/SETUP.sh" extra_flags="$ppc_cflags $debug_cflags" -extra_configs="$debug_configs $max_no_ndb_configs" +extra_configs="$debug_configs $max_configs" . "$path/FINISH.sh" diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b5c73b6e6c..85aadb81d5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,10 @@ ELSE() ENDIF() PROJECT(${MYSQL_PROJECT_NAME}) +SET(CPACK_PACKAGE_NAME "MariaDB") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB: a very fast and robust SQL database server") +SET(CPACK_PACKAGE_URL "http://mariadb.org") + IF(BUILD_CONFIG) INCLUDE( ${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake) @@ -158,6 +162,7 @@ INCLUDE(ctest) INCLUDE(plugin) INCLUDE(install_macros) INCLUDE(mysql_add_executable) +INCLUDE(wsrep) # Handle options OPTION(DISABLE_SHARED @@ -201,7 +206,12 @@ ENDIF() # enable security hardening features, like most distributions do # in our benchmarks that costs about ~1% of performance, depending on the load -OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON) +IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "4.6") + SET(security_default OFF) +ELSE() + SET(security_default ON) +ENDIF() +OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ${security_default}) IF(SECURITY_HARDENED) # security-enhancing flags MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC") @@ -235,6 +245,12 @@ OPTION(ENABLED_LOCAL_INFILE OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF) MARK_AS_ADVANCED(WITH_FAST_MUTEXES) +OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP}) +IF (WITH_INNODB_DISALLOW_WRITES) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_INNODB_DISALLOW_WRITES") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_INNODB_DISALLOW_WRITES") +ENDIF() + # Set DBUG_OFF and other optional release-only flags for non-debug project types FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL) FOREACH(LANG C CXX) @@ -372,9 +388,7 @@ ADD_SUBDIRECTORY(libmysql) ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(extra) ADD_SUBDIRECTORY(libservices) -ADD_SUBDIRECTORY(scripts) ADD_SUBDIRECTORY(sql/share) -ADD_SUBDIRECTORY(support-files) IF(NOT WITHOUT_SERVER) ADD_SUBDIRECTORY(tests) @@ -385,15 +399,13 @@ IF(NOT WITHOUT_SERVER) ADD_SUBDIRECTORY(libmysqld/examples) ENDIF(WITH_EMBEDDED_SERVER) + IF(WITH_WSREP) + ADD_SUBDIRECTORY(wsrep) + ENDIF() + ADD_SUBDIRECTORY(mysql-test) ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess) ADD_SUBDIRECTORY(sql-bench) - - IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt) - ADD_SUBDIRECTORY(internal) - ENDIF() - ADD_SUBDIRECTORY(packaging/rpm-uln) - ADD_SUBDIRECTORY(packaging/rpm-oel) ENDIF() IF(UNIX) @@ -409,6 +421,10 @@ IF(WIN32) ENDIF() ADD_SUBDIRECTORY(packaging/solaris) +INCLUDE(for_clients) +ADD_SUBDIRECTORY(scripts) +ADD_SUBDIRECTORY(support-files) + CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h) CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in @@ -447,6 +463,7 @@ INSTALL_DOCUMENTATION(${CMAKE_BINARY_DIR}/Docs/INFO_SRC IF(UNIX) INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY COMPONENT Readme) + INSTALL_DOCUMENTATION(Docs/INSTALL-BINARY Docs/README-wsrep COMPONENT Readme) ENDIF() INCLUDE(CPack) diff --git a/Docs/README-wsrep b/Docs/README-wsrep new file mode 100644 index 00000000000..422ec52f48a --- /dev/null +++ b/Docs/README-wsrep @@ -0,0 +1,488 @@ +Codership Oy +http://www.codership.com + + +DISCLAIMER + +THIS SOFTWARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +IN NO EVENT SHALL CODERSHIP OY BE HELD LIABLE TO ANY PARTY FOR ANY DAMAGES +RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE. + +Trademark Information. + +MySQL is a trademark or registered trademark of Oracle and/or its affiliates. +Other trademarks are the property of their respective owners. + +Licensing Information. + +Please see file COPYING that came with this distribution + +Source code can be found at +wsrep API: https://launchpad.net/wsrep +MySQL patch: https://launchpad.net/codership-mysql + + +ABOUT THIS DOCUMENT + +This document covers installation and configuration issues specific to this +wsrep-patched MySQL distribution by Codership. It does not cover the use or +administration of MySQL server per se. The reader is assumed to know how to +install, configure, administer and use standard MySQL server version 5.1.xx. + + + MYSQL-5.5.x/wsrep-23.x + +CONTENTS: +========= +1. WHAT IS WSREP PATCH FOR MYSQL +2. INSTALLATION +3. FIRST TIME SETUP + 3.1 CONFIGURATION FILES + 3.2 DATABASE PRIVILEGES + 3.3 CHECK AND CORRECT FIREWALL SETTINGS + 3.4 SELINUX + 3.5 APPARMOR + 3.6 CONNECT TO CLUSTER +4. UPGRADING FROM MySQL 5.1.x +5. CONFIGURATION OPTIONS + 5.1 MANDATORY MYSQL OPTIONS + 5.2 WSREP OPTIONS +6. ONLINE SCHEMA UPGRADE + 6.1 TOTAL ORDER ISOLATION (TOI) + 6.2 ROLLING SCHEMA UPGRADE (RSU) +7. LIMITATIONS + + +1. WHAT IS WSREP PATCH FOR MYSQL/INNODB + +Wsrep API developed by Codership Oy is a modern generic (database-agnostic) +replication API for transactional databases with a goal to make database +replication/logging subsystem completely modular and pluggable. It is developed +with flexibility and completeness in mind to satisfy broad range of modern +replication scenarios. It is equally suitable for synchronous and asynchronous, +master-slave and multi-master replication. + +wsrep stands for Write Set REPlication. + +Wsrep patch for MySQL/InnoDB allows MySQL server to load and use various wsrep +API implementations ("wsrep providers") with different qualities of service. +Without wsrep provider MySQL-wsrep server will function like a regular +standalone server. + + +2. INSTALLATION + +In the examples below mysql authentication options are omitted for brevity. + +2.1 Download and install mysql-wsrep package. + +Download binary package for your Linux distribution from +https://launchpad.net/codership-mysql/ + +2.1.1 On Debian and Debian-derived distributions. + +Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please +upgrade to mysql-server-5.1 first. + +If you're installing over an existing mysql installation, mysql-server-wsrep +will conflict with mysql-server-5.1 package, so remove it first: + +$ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1 + +mysql-server-wsrep requires psmisc and mysql-client-5.1.47 (or later). +MySQL 5.1 packages can be found from backports repositories. +For further information about configuring and using Debian or Ubuntu +backports, see: + +* http://backports.debian.org + +* https://help.ubuntu.com/community/UbuntuBackports + +For example, installation of required packages on Debian Lenny: + +$ sudo apt-get install psmisc +$ sudo apt-get -t lenny-backports install mysql-client-5.1 + +Now you should be able to install mysql-wsrep package: + +$ sudo dpkg -i + +2.1.2 On CentOS and similar RPM-based distributions. + +If you're migrating from existing MySQL installation, there are two variants: + + a) If you're already using official MySQL-server-community 5.1.x RPM from + Oracle: + + # rpm -e mysql-server + + b) If you're upgrading from the stock mysql-5.0.77 on CentOS: + + 1) Make sure that the following packages are not installed: + # rpm --nodeps --allmatches -e mysql-server mysql-test mysql-bench + + 2) Install *official* MySQL-shared-compat-5.1.x from + http://dev.mysql.com/downloads/mysql/5.1.html + +Actual installation: + + # rpm -Uvh + + If this fails due to unsatisfied dependencies, install missing packages + (e.g. yum install perl-DBI) and retry. + +Additional packages to consider (if not yet installed): + * galera (multi-master replication provider, https://launchpad.net/galera) + * MySQL-client-community (for connecting to server and mysqldump-based SST) + * rsync (for rsync-based SST) + * xtrabackup and nc (for xtrabackup-based SST) + +2.2 Upgrade system tables. + +If you're upgrading a previous MySQL installation, it might be advisable to +upgrade system tables. To do that start mysqld and run mysql_upgrade command. +Consult MySQL documentation in case of errors. Normally they are not critical +and can be ignored unless specific functionality is needed. + + +3. FIRST TIME SETUP + +Unless you're upgrading an already installed mysql-wsrep package, you will need +to set up a few things to prepare server for operation. + +3.1 CONFIGURATION FILES + +* Make sure system-wide my.cnf does not bind mysqld to 127.0.0.1. That is, if + you have the following line in [mysqld] section, comment it out: + + #bind-address = 127.0.0.1 + +* Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line. + +* Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying + a path to provider library. If you don't have a provider, leave it as it is. + +* When a new node joins the cluster it'll have to receive a state snapshot from + one of the peers. This requires a privileged MySQL account with access from + the rest of the cluster. Edit /etc/mysql/conf.d/wsrep.cnf and set mysql + login/password pair for SST, for example: + + wsrep_sst_auth=wsrep_sst:wspass + +* See CONFIGURATION section below about other configuration parameters that you + might want to change at this point. + +3.2 DATABASE PRIVILEGES + +Restart MySQL server and connect to it as root to grant privileges to SST +account (empty users confuse MySQL authentication matching rules, we need to +delete them too): + +$ mysql -e "SET wsrep_on=OFF; DELETE FROM mysql.user WHERE user='';" +$ mysql -e "SET wsrep_on=OFF; GRANT ALL ON *.* TO wsrep_sst@'%' IDENTIFIED BY 'wspass'"; + +3.3 CHECK AND CORRECT FIREWALL SETTINGS. + +MySQL-wsrep server needs to be accessible from other cluster members through +its client listening socket and through wsrep provider socket. See your +distribution and wsrep provider documentation for details. For example on +CentOS you might need to do something along these lines: + +# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source /24 --destination /32 --dport 3306 -j ACCEPT +# iptables --insert RH-Firewall-1-INPUT 1 --proto tcp --source /24 --destination /32 --dport 4567 -j ACCEPT + +If there is a NAT firewall between the nodes, it must be configured to allow +direct connections between the nodes (e.g. via port forwarding). + +3.4 SELINUX + +If you have SELinux enabled, it may block mysqld from doing required operations. +You'll need to either disable it or configure to allow mysqld to run external +programs and open listen sockets at unprivileged ports (i.e. things that +an unprivileged user can do). See SELinux documentation about it. + +To quickly disable SELinux: +1) run 'setenforce 0' as root. +2) set 'SELINUX=permissive' in /etc/selinux/config + +3.5 APPARMOR + +AppArmor automatically comes with Ubuntu and may also prevent mysqld to from +opening additional ports or run scripts. See AppArmor documentation about its +configuration. To disable AppArmor for mysqld: + +$ cd /etc/apparmor.d/disable/ +$ sudo ln -s /etc/apparmor.d/usr.sbin.mysqld +$ sudo service apparmor restart + + +3.6 CONNECT TO CLUSTER + +Now you're ready to connect to cluster by setting wsrep_cluster_address variable +and monitor status of wsrep provider: + +mysql> SET GLOBAL wsrep_cluster_address=''; +mysql> SHOW STATUS LIKE 'wsrep%'; + + +4 UPGRADING FROM MySQL 5.1.x + +!!! THESE INSTRUCTIONS ARE PRELIMINARY AND INCOMPLETE !!! + +1) BEFORE UPGRADE (while running 5.1.x): + - comment out 'wsrep_provider' setting from configuration files + (my.cnf and/or wsrep.cnf) + - If performing a rolling upgrade on a running cluster, set + wsrep_sst_method=mysqldump. + You might also need to configure wsrep_sst_receive_address and + wsrep_sst_auth appropriately. mysqldump is the only way to transfer data + from 5.1.x to 5.5.x reliably. + - remove innodb_plugin settings from configuration files. + +2) Perform upgrade as usual: + http://dev.mysql.com/doc/refman/5.5/en/upgrading-from-previous-series.html + Don't forget to run 'mysql_upgrade' command. + +3) AFTER UPGRADING individual node: + - uncomment 'wsrep_provider' line in configuration file. + - restart the server and join the cluster. + +4) AFTER UPGRADING the whole cluster: + - revert to usual wsrep SST settings if not 'mysqldump'. + + +5. CONFIGURATION OPTIONS + +5.1 MANDATORY MYSQL OPTIONS + +binlog_format=ROW + This option is required to use row-level replication as opposed to + statement-level. For performance and consistency considerations don't change + that. As a side effect, binlog, if turned on, can be ROW only. In future this + option won't have special meaning. + +innodb_autoinc_lock_mode=2 + This is a required parameter. Without it INSERTs into tables with + AUTO_INCREMENT column may fail. + autoinc lock modes 0 and 1 can cause unresolved deadlock, and make + system unresponsive. + +innodb_locks_unsafe_for_binlog=1 + This option is required for parallel applying. + +5.2 WSREP OPTIONS + +All options are optional except for wsrep_provider, wsrep_cluster_address, and +wsrep_sst_auth. + +wsrep_provider=none + A full path to the library that implements WSREP interface. If none is + specified, the server behaves like a regular mysqld. + +wsrep_provider_options= + Provider-specific option string. Check wsrep provider documentation or + http://www.codership.com/wiki + +wsrep_cluster_address= + Provider-specific cluster address string. This is used to connect a node to + the desired cluster. This option can be given either on mysqld startup or set + during runtime. See wsrep provider documentation for possible values. + +wsrep_cluster_name="my_wsrep_cluster" + Logical cluster name, must be the same for all nodes of the cluster. + +wsrep_node_address= + An option to explicitly specify the network address of the node in the form +
[:port] if autoguessing for some reason does not produce desirable + results (multiple network interfaces, NAT, etc.) + If not explicitly overridden by wsrep_sst_receive_address, the
part + will be used to listen for SST (see below). And the whole
[:port] + will be passed to wsrep provider to be used as a base address in its + communications. + +wsrep_node_name= + Human readable node name (for easier log reading only). Defaults to hostname. + +wsrep_slave_threads=1 + Number of threads dedicated to processing of writesets from other nodes. + For best performance should be few per CPU core. + +wsrep_dbug_option + Options for the built-in DBUG library (independent from what MySQL uses). + Empty by default. Not currently in use. + +wsrep_debug=0 + Enable debug-level logging. + +wsrep_convert_LOCK_to_trx=0 + Implicitly convert locking sessions into transactions inside mysqld. By + itself it does not mean support for locking sessions, but it prevents the + database from going into logically inconsistent state. Note however, that + loading large database dump with LOCK statements might result in abnormally + large transactions and cause an out-of-memory condition + +wsrep_retry_autocommit=1 + Retry autocommit queries and single statement transactions should they fail + certification test. This is analogous to rescheduling an autocommit query + should it go into deadlock with other transactions in the database lock + manager. + +wsrep_auto_increment_control=1 + Automatically adjust auto_increment_increment and auto_increment_offset + variables based on the number of nodes in the cluster. Significantly reduces + certification conflict rate for INSERTS. + +wsrep_drupal_282555_workaround=1 + MySQL seems to have an obscure bug when INSERT into table with + AUTO_INCREMENT column with NULL value for that column can fail with a + duplicate key error. When this option is on, it retries such INSERTs. + Required for stable Drupal operation. Documented at: + http://bugs.mysql.com/bug.php?id=41984 + http://drupal.org/node/282555 + +wsrep_causal_reads=0 + Enforce strict READ COMMITTED semantics on reads and transactions. May + result in additional latencies. It is a session variable. + +wsrep_OSU_method=TOI + Online Schema Upgrade (OSU) can be performed with two alternative methods: + Total Order Isolation (TOI) runs DDL statement in all cluster nodes in + same total order sequence locking the affected table for the duration of the + operation. This may result in the whole cluster being blocked for the + duration of the operation. + Rolling Schema Upgrade (RSU) executes the DDL statement only locally, thus + blocking only one cluster node. During the DDL processing, the node + is not replicating and may be unable to process replication events (due to + table lock). Once DDL operation is complete, the node will catch up and sync + with the cluster to become fully operational again. The DDL statement or + its effects are not replicated, so it is user's responsibility to manually + perform this operation on each of the nodes. + +wsrep_forced_binlog_format=none + Force every transaction to use given binlog format. When this variable is + set to something else than NONE, all transactions will use the given forced + format, regardless of what the client session has specified in binlog_format. + Valid choices for wsrep_forced_binlog_format are: ROW, STATEMENT, MIXED and + special value NONE, meaning that there is no forced binlog format in effect. + This variable was intruduced to support STATEMENT format replication during + rolling schema upgrade processing. However, in most cases ROW replication + is valid for asymmetrict schema replication. + +State snapshot transfer options. + +When a new node joins the cluster it has to synchronize its initial state with +the other cluster members by transferring state snapshot from one of them. +The options below govern how this happens and should be set up before attempting +to join or start a cluster. + +wsrep_sst_method=rsync + What method to use to copy database state to a newly joined node. Supported + methods: + - mysqldump: slow (except for small datasets) but allows for upgrade + between major MySQL versions or InnoDB features. + - rsync: much faster on large datasets (default). + - rsync_wan: same as rsync but with deltaxfer to minimize network traffic. + - xtrabackup: very fast and practically non-blocking SST method based on + Percona's xtrabackup tool. + + (for xtrabackup to work the following settings must be present in my.cnf + on all nodes: + [mysqld] + wsrep_sst_auth=root: + datadir= + [client] + socket= + ) + +wsrep_sst_receive_address= + Address (hostname:port) at which this node wants to receive state snapshot. + Defaults to mysqld bind address, and if that is not specified (0.0.0.0) - + to the first IP of eth0 + mysqld bind port. + NOTE: check that your firewall allows connections to this address from other + cluster nodes. + +wsrep_sst_auth= + Authentication information needed for state transfer. Depends on the state + transfer method. For mysqldump-based SST it is + : + and should be the same on all nodes - it is used to authenticate with both + state snapshot receiver and state snapshot donor. + +wsrep_sst_donor= + A name of the node which should serve as state snapshot donor. This allows + to control which node will serve state snapshot request. By default the + most suitable node is chosen by wsrep provider. This is the same as given in + wsrep_node_name. + + +6. ONLINE SCHEMA UPGRADE + + Schema upgrades mean any data definition statements (DDL statemnents) run + for the database. They change the database structure and are non- + transactional. + + Release 22.3 brings a new method for performing schema upgrades. User can + now choose whether to use the traditional total order isolation or new + rolling schema upgrade method. The OSU method choice is done by global + parameter: 'wsrep_OSU_method'. + +6.1 Total Order Isolation (TOI) + + With earlier releases, DDL processing happened always by Total Order + Isolation (TOI) method. With TOI, the DDL was scheduled to be processed in + same transaction seqeuncing 'slot' in each cluster node. + The processing is secured by locking the affected table from any other use. + With TOI method, the whole cluster has part of the database locked for the + duration of the DDL processing. + +6.2 Rolling Schema Upgrade (RSU) + + Rolling schema upgrade is new DDL processing method, where DDL will be + processed locally for the node. The node is disconnected of the replication + for the duration of the DDL processing, so that there is only DDL statement + processing in the node and it does not block the rest of the cluster. When + the DDL processing is complete, the node applies delayed replication events + and synchronizes back with the cluster. + The DDL can then be executed cluster-wide by running the same DDL statement + for each node in turn. When this rolling schema upgrade proceeds, part of + the cluster will have old schema structure and part of the cluster will have + new schema structure. + + +7. LIMITATIONS + +1) Currently replication works only with InnoDB storage engine. Any writes to + tables of other types, including system (mysql.*) tables are not replicated. + However, DDL statements are replicated in statement level, and changes + to mysql.* tables will get replicated that way. + So, you can safely issue: CREATE USER..., + but issuing: INSERT INTO mysql.user..., will not be replicated. + +2) DELETE operation is unsupported on tables without primary key. Also rows in + tables without primary key may appear in different order on different nodes. + As a result SELECT...LIMIT... may return slightly different sets. + +3) Unsupported queries: + * LOCK/UNLOCK TABLES cannot be supported in multi-master setups. + * lock functions (GET_LOCK(), RELEASE_LOCK()... ) + +4) Query log cannot be directed to table. If you enable query logging, + you must forward the log to a file: + log_output = FILE + Use general_log and general_log_file to choose query logging and the + log file name + +5) Maximum allowed transaction size is defined by wsrep_max_ws_rows and + wsrep_max_ws_size. Anything bigger (e.g. huge LOAD DATA) will be rejected. + +6) Due to cluster level optimistic concurrency control, transaction issuing + COMMIT may still be aborted at that stage. There can be two transactions. + writing to same rows and committing in separate cluster nodes, and only one + of the them can successfully commit. The failing one will be aborted. + For cluster level aborts, MySQL/galera cluster gives back deadlock error. + code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)). + +7) XA transactions can not be supported due to possible rollback on commit. + diff --git a/client/mysql.cc b/client/mysql.cc index b1570e32a80..510bceecac2 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -590,8 +590,6 @@ static COMMANDS commands[] = { { "NAMES", 0, 0, 0, ""}, { "NATIONAL", 0, 0, 0, ""}, { "NATURAL", 0, 0, 0, ""}, - { "NDB", 0, 0, 0, ""}, - { "NDBCLUSTER", 0, 0, 0, ""}, { "NCHAR", 0, 0, 0, ""}, { "NEW", 0, 0, 0, ""}, { "NEXT", 0, 0, 0, ""}, diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 80d57ce9faa..65ea586c672 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -523,7 +523,21 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, int ret; File fd; char query_file_path[FN_REFLEN]; +#ifdef WITH_WSREP + /* + Strictly speaking, WITH_WSREP on the client only means that the + client was compiled with WSREP, it doesn't mean the server was, + so the server might not have WSREP_ON variable. + + But mysql_upgrade is tightly bound to a specific server version + anyway - it was mysql_fix_privilege_tables_sql script embedded + into its binary - so even if it won't assume anything about server + wsrep-ness, it won't be any less server-dependend. + */ + const uchar sql_log_bin[]= "SET SQL_LOG_BIN=0, WSREP_ON=OFF;"; +#else const uchar sql_log_bin[]= "SET SQL_LOG_BIN=0;"; +#endif /* WITH_WSREP */ DBUG_ENTER("run_query"); DBUG_PRINT("enter", ("query: %s", query)); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index bd5d2eac4e5..5ba463f8d6f 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -693,10 +693,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) if (mysql_refresh(mysql, (uint) ~(REFRESH_GRANT | REFRESH_STATUS | REFRESH_READ_LOCK | REFRESH_SLAVE | - REFRESH_MASTER | REFRESH_TABLE_STATS | - REFRESH_INDEX_STATS | - REFRESH_USER_STATS | - REFRESH_CLIENT_STATS))) + REFRESH_MASTER))) { my_printf_error(0, "refresh failed; error: '%s'", error_flags, mysql_error(mysql)); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 57b7ce09ab5..fc196d2f27a 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -731,10 +731,11 @@ static int use_db(char *database) DBUG_RETURN(0); } /* use_db */ +/* Do not send commands to replication slaves. */ static int disable_binlog() { - const char *stmt= "SET SQL_LOG_BIN=0"; - return run_query(stmt); + mysql_query(sock, "SET WSREP_ON=0"); /* ignore the error, if any */ + return run_query("SET SQL_LOG_BIN=0"); } static int handle_request_for_tables(char *tables, uint length) diff --git a/client/mysqldump.c b/client/mysqldump.c index cb4fa022d4f..98f6f15b46e 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -39,7 +39,7 @@ ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov */ -#define DUMP_VERSION "10.15" +#define DUMP_VERSION "10.16" #include #include @@ -111,7 +111,8 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_slave_apply= 0, opt_include_master_host_port= 0, opt_events= 0, opt_comments_used= 0, - opt_alltspcs=0, opt_notspcs= 0; + opt_galera_sst_mode= 0, + opt_alltspcs=0, opt_notspcs= 0, opt_logging; static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*mysql=0; @@ -346,6 +347,14 @@ static struct my_option my_long_options[] = {"force", 'f', "Continue even if we get an SQL error.", &ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"galera-sst-mode", 0, + "This mode should normally be used in mysqldump snapshot state transfer " + "(SST) in a Galera cluster. If enabled, mysqldump additionally dumps " + "commands to turn off binary logging and SET global gtid_binlog_state " + "with the current value. Note: RESET MASTER needs to be executed on the " + "server receiving the resulting dump.", + &opt_galera_sst_mode, &opt_galera_sst_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, " @@ -381,6 +390,8 @@ static struct my_option my_long_options[] = {"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.", &log_error_file, &log_error_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"log-queries", 0, "When restoring the dump, the server will, if logging turned on, log the queries to the general and slow query log.", + &opt_logging, &opt_logging, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"master-data", OPT_MASTER_DATA, "This causes the binary log position and filename to be appended to the " "output. If equal to 1, will print it as a CHANGE MASTER command; if equal" @@ -663,6 +674,10 @@ static void write_header(FILE *sql_file, char *db_name) print_comment(sql_file, 0, "-- Server version\t%s\n", mysql_get_server_info(&mysql_connection)); + if (!opt_logging) + fprintf(sql_file, +"\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL SLOW_QUERY_LOG=0 */;"); + if (opt_set_charset) fprintf(sql_file, "\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" @@ -4799,6 +4814,42 @@ static int dump_selected_tables(char *db, char **table_names, int tables) } /* dump_selected_tables */ +/** + Add the following statements to the generated dump: + a) SET @@session.sql_log_bin=OFF; + b) SET @@global.gtid_binlog_state='[N-N-N,...]' +*/ +static int wsrep_set_sst_cmds(MYSQL *mysql) { + MYSQL_RES *res; + MYSQL_ROW row; + + if (mysql_get_server_version(mysql) < 100005) { + /* @@gtid_binlog_state does not exist. */ + return 0; + } + + if (mysql_query_with_error_report(mysql, &res, "SELECT " + "@@global.gtid_binlog_state")) + return 1; + + if (mysql_num_rows(res) != 1) + /* No entry for @@global.gtid_binlog_state, nothing needs to be done. */ + return 0; + + if (!(row= mysql_fetch_row(res)) || !(char *)row[0]) + return 1; + + /* first, add a command to turn off binary logging, */ + fprintf(md_result_file, "SET @@session.sql_log_bin=OFF;\n"); + + /* followed by, a command to set global gtid_binlog_state. */ + fprintf(md_result_file, "SET @@global.gtid_binlog_state='%s';\n", + (char*)row[0]); + + mysql_free_result(res); + return 0; +} + static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos) { MYSQL_ROW row; @@ -5743,6 +5794,10 @@ int main(int argc, char **argv) /* Add 'STOP SLAVE to beginning of dump */ if (opt_slave_apply && add_stop_slave()) goto err; + + if (opt_galera_sst_mode && wsrep_set_sst_cmds(mysql)) + goto err; + if (opt_master_data && do_show_master_status(mysql, consistent_binlog_pos)) goto err; if (opt_slave_data && do_show_slave_status(mysql)) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index ef339d17a42..635b9b51cda 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -4740,10 +4740,6 @@ void do_sync_with_master(struct st_command *command) } -/* - when ndb binlog is on, this call will wait until last updated epoch - (locally in the mysqld) has been received into the binlog -*/ int do_save_master_pos() { MYSQL_RES *res; @@ -4752,144 +4748,6 @@ int do_save_master_pos() const char *query; DBUG_ENTER("do_save_master_pos"); -#ifdef HAVE_NDB_BINLOG - /* - Wait for ndb binlog to be up-to-date with all changes - done on the local mysql server - */ - { - ulong have_ndbcluster; - if (mysql_query(mysql, query= "show variables like 'have_ndbcluster'")) - die("'%s' failed: %d %s", query, - mysql_errno(mysql), mysql_error(mysql)); - if (!(res= mysql_store_result(mysql))) - die("mysql_store_result() returned NULL for '%s'", query); - if (!(row= mysql_fetch_row(res))) - die("Query '%s' returned empty result", query); - - have_ndbcluster= strcmp("YES", row[1]) == 0; - mysql_free_result(res); - - if (have_ndbcluster) - { - ulonglong start_epoch= 0, handled_epoch= 0, - latest_epoch=0, latest_trans_epoch=0, - latest_handled_binlog_epoch= 0, latest_received_binlog_epoch= 0, - latest_applied_binlog_epoch= 0; - int count= 0; - int do_continue= 1; - while (do_continue) - { - const char binlog[]= "binlog"; - const char latest_epoch_str[]= - "latest_epoch="; - const char latest_trans_epoch_str[]= - "latest_trans_epoch="; - const char latest_received_binlog_epoch_str[]= - "latest_received_binlog_epoch"; - const char latest_handled_binlog_epoch_str[]= - "latest_handled_binlog_epoch="; - const char latest_applied_binlog_epoch_str[]= - "latest_applied_binlog_epoch="; - if (count) - my_sleep(100*1000); /* 100ms */ - if (mysql_query(mysql, query= "show engine ndb status")) - die("failed in '%s': %d %s", query, - mysql_errno(mysql), mysql_error(mysql)); - if (!(res= mysql_store_result(mysql))) - die("mysql_store_result() returned NULL for '%s'", query); - while ((row= mysql_fetch_row(res))) - { - if (strcmp(row[1], binlog) == 0) - { - const char *status= row[2]; - - /* latest_epoch */ - while (*status && strncmp(status, latest_epoch_str, - sizeof(latest_epoch_str)-1)) - status++; - if (*status) - { - status+= sizeof(latest_epoch_str)-1; - latest_epoch= strtoull(status, (char**) 0, 10); - } - else - die("result does not contain '%s' in '%s'", - latest_epoch_str, query); - /* latest_trans_epoch */ - while (*status && strncmp(status, latest_trans_epoch_str, - sizeof(latest_trans_epoch_str)-1)) - status++; - if (*status) - { - status+= sizeof(latest_trans_epoch_str)-1; - latest_trans_epoch= strtoull(status, (char**) 0, 10); - } - else - die("result does not contain '%s' in '%s'", - latest_trans_epoch_str, query); - /* latest_received_binlog_epoch */ - while (*status && - strncmp(status, latest_received_binlog_epoch_str, - sizeof(latest_received_binlog_epoch_str)-1)) - status++; - if (*status) - { - status+= sizeof(latest_received_binlog_epoch_str)-1; - latest_received_binlog_epoch= strtoull(status, (char**) 0, 10); - } - else - die("result does not contain '%s' in '%s'", - latest_received_binlog_epoch_str, query); - /* latest_handled_binlog */ - while (*status && - strncmp(status, latest_handled_binlog_epoch_str, - sizeof(latest_handled_binlog_epoch_str)-1)) - status++; - if (*status) - { - status+= sizeof(latest_handled_binlog_epoch_str)-1; - latest_handled_binlog_epoch= strtoull(status, (char**) 0, 10); - } - else - die("result does not contain '%s' in '%s'", - latest_handled_binlog_epoch_str, query); - /* latest_applied_binlog_epoch */ - while (*status && - strncmp(status, latest_applied_binlog_epoch_str, - sizeof(latest_applied_binlog_epoch_str)-1)) - status++; - if (*status) - { - status+= sizeof(latest_applied_binlog_epoch_str)-1; - latest_applied_binlog_epoch= strtoull(status, (char**) 0, 10); - } - else - die("result does not contain '%s' in '%s'", - latest_applied_binlog_epoch_str, query); - if (count == 0) - start_epoch= latest_trans_epoch; - break; - } - } - if (!row) - die("result does not contain '%s' in '%s'", - binlog, query); - if (latest_handled_binlog_epoch > handled_epoch) - count= 0; - handled_epoch= latest_handled_binlog_epoch; - count++; - if (latest_handled_binlog_epoch >= start_epoch) - do_continue= 0; - else if (count > 300) /* 30s */ - { - break; - } - mysql_free_result(res); - } - } - } -#endif if (mysql_query(mysql, query= "show master status")) die("failed in 'show master status': %d %s", mysql_errno(mysql), mysql_error(mysql)); @@ -10200,7 +10058,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern, { /* find the match */ err_code= regexec(&r,str_p, r.re_nsub+1, subs, - (str_p == string) ? REG_NOTBOL : 0); + (str_p == string) ? 0 : REG_NOTBOL); /* if regular expression error (eg. bad syntax, or out of memory) */ if (err_code && err_code != REG_NOMATCH) diff --git a/cmake/configure.pl b/cmake/configure.pl index a71795a3bc8..b528cda70dc 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -167,7 +167,7 @@ foreach my $option (@ARGV) } if($option =~ /with-debug/) { - $cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug"; + $cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF"; next; } if($option =~ /with-ssl/) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 30924120526..0543a862a23 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -27,15 +27,15 @@ SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts ManPagesTest Readme ManPagesClient Test Common Client SharedLibraries) -SET(CPACK_RPM_PACKAGE_NAME "MariaDB") +SET(CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME}) SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}") SET(CPACK_RPM_PACKAGE_LICENSE "GPL") SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") -SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org") -SET(CPACK_RPM_PACKAGE_SUMMARY "MariaDB: a very fast and robust SQL database server") +SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_SUMMARY}) +SET(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_URL}) SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_SUMMARY} It is GPL v2 licensed, which means you can use the it free of charge under the @@ -147,9 +147,15 @@ SETA(CPACK_RPM_test_PACKAGE_OBSOLETES SETA(CPACK_RPM_test_PACKAGE_PROVIDES "MySQL-test") -SETA(CPACK_RPM_server_PACKAGE_REQUIRES - ${CPACK_RPM_PACKAGE_REQUIRES} - "MariaDB-client") +SETA(CPACK_RPM_server_PACKAGE_REQUIRES + "${CPACK_RPM_PACKAGE_REQUIRES}" + "MariaDB-client") + +IF(WITH_WSREP) +SETA(CPACK_RPM_server_PACKAGE_REQUIRES + "galera" "rsync" "lsof" "socat" "grep" "gawk" "iproute" + "coreutils" "findutils") +ENDIF() SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh) SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh) diff --git a/cmake/for_clients.cmake b/cmake/for_clients.cmake new file mode 100644 index 00000000000..7667e59e8f6 --- /dev/null +++ b/cmake/for_clients.cmake @@ -0,0 +1,77 @@ +# +# Generate LIBS and CFLAGS that third-party clients should use +# + +# Use cmake variables to inspect dependencies for +# mysqlclient library (add -l stuff) +SET(CLIENT_LIBS "") +SET(LIBS "") + +# Avoid compatibility warning about lists with empty elements +IF(POLICY CMP0011) + CMAKE_POLICY(SET CMP0011 NEW) +ENDIF() +IF(POLICY CMP0007) + CMAKE_POLICY(SET CMP0007 OLD) +ENDIF() + +# Extract dependencies using CMake's internal ${target}_LIB_DEPENDS variable +# returned string in ${var} is can be passed to linker's command line +MACRO(EXTRACT_LINK_LIBRARIES target var) + IF(${target}_LIB_DEPENDS) + LIST(REMOVE_ITEM ${target}_LIB_DEPENDS "") + LIST(REMOVE_DUPLICATES ${target}_LIB_DEPENDS) + FOREACH(lib ${${target}_LIB_DEPENDS}) + # Filter out "general", it is not a library, just CMake hint + # Also, remove duplicates + IF(NOT lib STREQUAL "general" AND NOT ${var} MATCHES "-l${lib} ") + IF (lib MATCHES "^\\-l") + SET(${var} "${${var}} ${lib} ") + ELSEIF(lib MATCHES "^/") + IF (lib MATCHES "\\.(a|so([0-9.]*)|lib|dll|dylib)$") + # Full path, convert to just filename, strip "lib" prefix and extension + GET_FILENAME_COMPONENT(lib "${lib}" NAME_WE) + STRING(REGEX REPLACE "^lib" "" lib "${lib}") + SET(${var} "${${var}}-l${lib} " ) + ENDIF() + ELSE() + SET(${var} "${${var}}-l${lib} " ) + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() + IF(MSVC) + STRING(REPLACE "-l" "" ${var} "${${var}}") + ENDIF() +ENDMACRO() + +EXTRACT_LINK_LIBRARIES(mysqlclient LIBS) +EXTRACT_LINK_LIBRARIES(mysqlserver EMB_LIBS) + +SET(LIBS "-lmysqlclient ${ZLIB_DEPS} ${LIBS} ${openssl_libs}") +SET(EMB_LIBS "-lmysqld ${ZLIB_DEPS} ${EMB_LIBS} ${openssl_libs}") + +MACRO(REPLACE_FOR_CLIENTS VAR) + SET(v " ${${VAR}} ") + FOREACH(del ${ARGN}) + STRING(REGEX REPLACE " -(${del}) " " " v ${v}) + ENDFOREACH(del) + STRING(REGEX REPLACE " +" " " v ${v}) + STRING(STRIP "${v}" ${VAR}_FOR_CLIENTS) +ENDMACRO() + +# Remove some options that a client doesn't have to care about +# FIXME until we have a --cxxflags, we need to remove -Xa +# and -xstrconst to make --cflags usable for Sun Forte C++ +# FIXME until we have a --cxxflags, we need to remove -AC99 +# to make --cflags usable for HP C++ (aCC) +REPLACE_FOR_CLIENTS(CFLAGS "[DU]DBUG_OFF" "[DU]SAFE_MUTEX" "[DU]NDEBUG" + "[DU]UNIV_MUST_NOT_INLINE" "[DU]FORCE_INIT_OF_VARS" "[DU]EXTRA_DEBUG" "[DU]HAVE_valgrind" + "O" "O[0-9]" "xO[0-9]" "W[-A-Za-z]*" "mtune=[-A-Za-z0-9]*" "g" "fPIC" + "mcpu=[-A-Za-z0-9]*" "unroll2" "ip" "mp" "march=[-A-Za-z0-9]*" "Xa" + "xstrconst" "xc99=none" "AC99" "restrict") + +# Same for --libs +REPLACE_FOR_CLIENTS(LIBS lmtmalloc static-libcxa i-static static-intel) +REPLACE_FOR_CLIENTS(EMB_LIBS lmtmalloc static-libcxa i-static static-intel) + diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 2f88c47e17f..b8c8877ef61 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -116,15 +116,6 @@ CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc ${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY) -# Copy spec files -SET(SPECFILENAME "mysql.${VERSION}.spec") -IF("${VERSION}" MATCHES "-ndb-") - STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}") - SET(SPECFILENAME "mysql-cluster-${NDBVERSION}.spec") -ENDIF() -CONFIGURE_FILE(${CMAKE_BINARY_DIR}/support-files/${SPECFILENAME} - ${PACKAGE_DIR}/support-files/${SPECFILENAME} COPYONLY) - # Add documentation, if user has specified where to find them IF(MYSQL_DOCS_LOCATION) MESSAGE("Copying documentation files from " ${MYSQL_DOCS_LOCATION}) diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index f147f6ef2bf..1802b1a2678 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -59,10 +59,6 @@ IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR MESSAGE(STATUS "MariaDB ${VERSION}") SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version") SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") - # Use NDBVERSION irregardless of whether this is Cluster or not, if not - # then the regex will be ignored anyway. - STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}") - STRING(REPLACE "-" "_" MYSQL_RPM_VERSION "${NDBVERSION}") MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH_VERSION}") MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION) SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION}) @@ -93,10 +89,6 @@ ENDIF() IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME) SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}") - IF("${VERSION}" MATCHES "-ndb-") - STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}") - SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mysql-cluster-gpl-${NDBVERSION}") - ENDIF() ENDIF() SET(CPACK_PACKAGE_CONTACT "MariaDB team ") SET(CPACK_PACKAGE_VENDOR "Monty Program AB") diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 4786108ec8c..8eccf47aa66 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -76,6 +76,7 @@ SET(HAVE_FSYNC CACHE INTERNAL "") SET(HAVE_FTIME 1 CACHE INTERNAL "") SET(HAVE_FTRUNCATE CACHE INTERNAL "") SET(HAVE_GETADDRINFO 1 CACHE INTERNAL "") +SET(HAVE_GETIFADDRS CACHE INTERNAL "") SET(HAVE_GETCWD 1 CACHE INTERNAL "") SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "") SET(HAVE_GETHRTIME CACHE INTERNAL "") diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake index 4ba8fc18e3f..c1c335f91f9 100644 --- a/cmake/package_name.cmake +++ b/cmake/package_name.cmake @@ -126,12 +126,7 @@ IF(NOT VERSION) SET(PRODUCT_TAG) ENDIF() - IF("${VERSION}" MATCHES "-ndb-") - STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}") - SET(package_name "mysql-cluster${PRODUCT_TAG}-${NDBVERSION}-${SYSTEM_NAME_AND_PROCESSOR}") - ELSE() - SET(package_name "mariadb${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") - ENDIF() + SET(package_name "mariadb${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") MESSAGE(STATUS "Packaging as: ${package_name}") diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index b550695b796..632c4cfe442 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -104,6 +104,7 @@ MACRO(MYSQL_ADD_PLUGIN) ELSE() SET(with_var "WITH_${plugin}") ENDIF() + UNSET(${with_var} CACHE) IF(NOT ARG_DEPENDENCIES) SET(ARG_DEPENDENCIES) @@ -153,7 +154,7 @@ MACRO(MYSQL_ADD_PLUGIN) ADD_DEPENDENCIES(${target}_embedded GenError) ENDIF() ENDIF() - + IF(ARG_STATIC_OUTPUT_NAME) SET_TARGET_PROPERTIES(${target} PROPERTIES OUTPUT_NAME ${ARG_STATIC_OUTPUT_NAME}) @@ -185,8 +186,10 @@ MACRO(MYSQL_ADD_PLUGIN) ADD_VERSION_INFO(${target} MODULE SOURCES) ADD_LIBRARY(${target} MODULE ${SOURCES}) DTRACE_INSTRUMENT(${target}) + SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "" COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN") + TARGET_LINK_LIBRARIES (${target} mysqlservices ${ARG_LINK_LIBRARIES}) # Plugin uses symbols defined in mysqld executable. @@ -201,13 +204,12 @@ MACRO(MYSQL_ADD_PLUGIN) ENDIF() ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) - UNSET(${with_var} CACHE) - SET_TARGET_PROPERTIES(${target} PROPERTIES OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}") # Install dynamic library IF(ARG_COMPONENT) - IF(CPACK_COMPONENTS_ALL AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT}) + IF(CPACK_COMPONENTS_ALL AND + NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT}) SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ${ARG_COMPONENT} PARENT_SCOPE) SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server" PARENT_SCOPE) diff --git a/cmake/readline.cmake b/cmake/readline.cmake index c99557683a6..ad6a7382e2a 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -116,9 +116,9 @@ ENDMACRO() MACRO (MYSQL_USE_BUNDLED_READLINE) SET(USE_NEW_READLINE_INTERFACE 1) SET(HAVE_HIST_ENTRY 0 CACHE INTERNAL "" FORCE) - SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/cmd-line-utils) + SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extra) SET(READLINE_LIBRARY readline) - ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/cmd-line-utils/readline) + ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/readline) ENDMACRO() MACRO (MYSQL_FIND_SYSTEM_READLINE) diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake new file mode 100644 index 00000000000..211ed30ff4c --- /dev/null +++ b/cmake/wsrep.cmake @@ -0,0 +1,56 @@ +# Copyright (c) 2011, Codership Oy . +# Copyright (c) 2013, Monty Program Ab. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# +# Galera library does not compile with windows +# +IF(UNIX) + SET(with_wsrep_default ON) +ELSE() + SET(with_wsrep_default OFF) +ENDIF() + +OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default}) + +# Set the patch version +SET(WSREP_PATCH_VERSION "10") + +# MariaDB addition: Revision number of the last revision merged from +# codership branch visible in @@version_comment. +# Branch : codership-mysql/5.6 +SET(WSREP_PATCH_REVNO "4123") # Should be updated on every merge. + +# MariaDB addition: Revision number of the last revision merged from +# Branch : lp:maria/maria-10.0-galera +SET(WSREP_PATCH_REVNO2 "3867") # Should be updated on every merge. + +# MariaDB: Obtain patch revision number: +# Update WSREP_PATCH_REVNO if WSREP_REV environment variable is set. +IF (DEFINED ENV{WSREP_REV}) + SET(WSREP_PATCH_REVNO $ENV{WSREP_REV}) +ENDIF() + +SET(WSREP_INTERFACE_VERSION 25) + +SET(WSREP_VERSION + "${WSREP_INTERFACE_VERSION}.${WSREP_PATCH_VERSION}.r${WSREP_PATCH_REVNO}") + +SET(WSREP_PROC_INFO ${WITH_WSREP}) + +IF(WITH_WSREP) + SET(COMPILATION_COMMENT "${COMPILATION_COMMENT}, wsrep_${WSREP_VERSION}") +ENDIF() + diff --git a/cmd-line-utils/libedit/CMakeLists.txt b/cmd-line-utils/libedit/CMakeLists.txt deleted file mode 100644 index 1f9aa29fb4a..00000000000 --- a/cmd-line-utils/libedit/CMakeLists.txt +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ) -INCLUDE(CheckIncludeFile) -include(CheckFunctionExists) -CHECK_INCLUDE_FILES(term.h HAVE_TERM_H) - -SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY}) -CHECK_CXX_SOURCE_COMPILES(" -#include -int main() -{ - tgoto(0,0,0); - return 0; -}" HAVE_DECL_TGOTO) -IF(NOT HAVE_DECL_TGOTO) - # On Solaris 11, term.h is broken, curses.h is also required. - CHECK_CXX_SOURCE_COMPILES(" - #include - #include - int main() - { - tgoto(0,0,0); - return 0; - }" HAVE_DECL_TGOTO2) - IF(HAVE_DECL_TGOTO2) - SET(HAVE_DECL_TGOTO 1 CACHE INTERNAL "" FORCE) - ENDIF() -ENDIF() - -SET(CMAKE_REQUIRED_LIBRARIES) - - - -IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") - #On Solaris, default awk is next to unusable while the xpg4 one is ok. - IF(EXISTS /usr/xpg4/bin/awk) - SET(AWK_EXECUTABLE /usr/xpg4/bin/awk) - ENDIF() -ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "OS400") - #Workaround for cases, where /usr/bin/gawk is not executable - IF(EXISTS /QOpenSys/usr/bin/awk) - SET(AWK_EXECUTABLE /QOpenSys/usr/bin/awk) - ENDIF() -ENDIF() - -IF(NOT AWK_EXECUTABLE) - FIND_PROGRAM(AWK_EXECUTABLE NAMES gawk awk DOC "path to the awk executable") -ENDIF() - -MARK_AS_ADVANCED(AWK_EXECUTABLE) -SET(AWK ${AWK_EXECUTABLE}) -CONFIGURE_FILE(makelist.sh ${CMAKE_CURRENT_BINARY_DIR}/makelist @ONLY) - -include(CheckIncludeFile) - -CHECK_INCLUDE_FILE(vis.h HAVE_VIS_H) -IF(HAVE_VIS_H) - CHECK_FUNCTION_EXISTS(strvis HAVE_STRVIS) - IF(NOT HAVE_STRVIS) - SET(HAVE_VIS_H FALSE CACHE INTERNAL "" FORCE) - ENDIF() -ENDIF() - -CHECK_FUNCTION_EXISTS(strvis HAVE_STRVIS) -IF(NOT HAVE_STRVIS) - SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/vis.c) -ENDIF() - -CHECK_FUNCTION_EXISTS(strunvis HAVE_STRUNVIS) -IF(NOT HAVE_STRUNVIS) - SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/unvis.c) -ENDIF() - -CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY) -IF(NOT HAVE_STRLCPY) - SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/strlcpy.c) -ENDIF() - -CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT) -IF(NOT HAVE_STRLCAT) - SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/strlcat.c) -ENDIF() - -CHECK_FUNCTION_EXISTS(fgetln HAVE_FGETLN) -IF(NOT HAVE_FGETLN) - SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/fgetln.c) -ENDIF() - -CHECK_FUNCTION_EXISTS(fgetln HAVE_WCSDUP) -IF(NOT HAVE_WCSDUP) - SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/wcsdup.c) -ENDIF() - -# Generate headers -FOREACH(SRCBASENAME vi emacs common) - SET(SRC ${CMAKE_CURRENT_SOURCE_DIR}/${SRCBASENAME}.c) - SET(HDR ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASENAME}.h) - - ADD_CUSTOM_COMMAND( - OUTPUT ${HDR} - COMMAND sh ./makelist -h ${SRC} > ${HDR} - DEPENDS ${SRC}) - - SET(AHDR ${AHDR} ${HDR}) - SET(ASRC ${ASRC} ${SRC}) -ENDFOREACH() - -# Generate source files -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/help.c - COMMAND sh ./makelist -bc ${ASRC} > help.c - DEPENDS ${ASRC} -) - -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/help.h - COMMAND sh ./makelist -bh ${ASRC} > help.h - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${ASRC} -) - -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fcns.h - COMMAND sh ./makelist -fh ${AHDR} > fcns.h - VERBATIM - DEPENDS ${AHDR} -) - -ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fcns.c - COMMAND sh ./makelist -fc ${AHDR} > fcns.c - VERBATIM - DEPENDS ${AHDR} -) - - -INCLUDE_DIRECTORIES( -${CMAKE_SOURCE_DIR}/include -${CMAKE_CURRENT_BINARY_DIR} -${CURSES_INCLUDE_PATH} -) - -SET(LIBEDIT_SOURCES - chared.c - chartype.c - el.c - eln.c - history.c - historyn.c - map.c - prompt.c - readline.c - search.c - tokenizer.c - tokenizern.c - vi.c - common.c - emacs.c - hist.c - keymacro.c - parse.c - read.c - refresh.c - sig.c - terminal.c - tty.c - filecomplete.c - ${CMAKE_CURRENT_BINARY_DIR}/help.c - ${CMAKE_CURRENT_BINARY_DIR}/help.h - ${CMAKE_CURRENT_BINARY_DIR}/fcns.c - ${CMAKE_CURRENT_BINARY_DIR}/fcns.h - ${AHDR} - ${LIBEDIT_EXTRA_SOURCES} -) -ADD_LIBRARY(edit STATIC ${LIBEDIT_SOURCES}) -TARGET_LINK_LIBRARIES(edit ${CURSES_LIBRARY}) - diff --git a/cmd-line-utils/libedit/README b/cmd-line-utils/libedit/README deleted file mode 100644 index c4bc1554b03..00000000000 --- a/cmd-line-utils/libedit/README +++ /dev/null @@ -1,50 +0,0 @@ -An approximate method to merge from upstream is: - - # Fetch latest from upstream (we also include some compat stuff) - $ CVS_RSH=ssh; export CVS_RSH - $ CVSROOT="anoncvs@anoncvs.netbsd.org:/cvsroot" - $ cvs co -d libedit -P src/lib/libedit - $ mkdir libedit/np - $ for f in src/common/lib/libc/string/strlcat.c \ - > src/common/lib/libc/string/strlcpy.c \ - > src/include/vis.h \ - > src/lib/libc/gen/unvis.c \ - > src/lib/libc/gen/vis.c \ - > src/tools/compat/fgetln.c - > do - > cvs co -P ${f} - > mv ${f} libedit/np - > done - $ rm -rf src - $ cd libedit - - # Remove files we don't need/use - $ rm -rf CVS TEST Makefile shlib_version *.[0-9] - $ (cd readline; rm -rf CVS Makefile) - - # Rename files to match our naming - $ mv makelist makelist.sh - $ mv terminal.h el_terminal.h - - # Remove NetBSD-specific bits - $ for file in $(find . -type f) - > do - > cp ${file} ${file}.orig - > sed -e 's/#include "terminal.h"/#include "el_terminal.h"/g' \ - > -e 's/sig_handler/el_sig_handler/g' \ - > -e 's/isprint/el_isprint/g' \ - > -e '/^__RCSID/d' \ - > ${file}.orig >${file} - > rm ${file}.orig - > done - -then merge remaining bits by hand. All MySQL-specific changes should be -marked with XXXMYSQL to make them easier to identify and merge. To generate -a 'clean' diff against upstream you can use the above commands but use - - cvs co -D "2011/10/23 17:37:55" [..] - -to fetch the baseline of most recent merge. - -Please feed any fixes to Jonathan Perkin who will -endeavour to merge them upstream and keep diffs minimal. diff --git a/cmd-line-utils/libedit/chared.c b/cmd-line-utils/libedit/chared.c deleted file mode 100644 index 647a5afe439..00000000000 --- a/cmd-line-utils/libedit/chared.c +++ /dev/null @@ -1,739 +0,0 @@ -/* $NetBSD: chared.c,v 1.36 2011/10/23 17:37:55 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * chared.c: Character editor utilities - */ -#include -#include "el.h" - -private void ch__clearmacro (EditLine *); - -/* value to leave unused in line buffer */ -#define EL_LEAVE 2 - -/* cv_undo(): - * Handle state for the vi undo command - */ -protected void -cv_undo(EditLine *el) -{ - c_undo_t *vu = &el->el_chared.c_undo; - c_redo_t *r = &el->el_chared.c_redo; - size_t size; - - /* Save entire line for undo */ - size = (size_t)(el->el_line.lastchar - el->el_line.buffer); - vu->len = (ssize_t)size; - vu->cursor = (int)(el->el_line.cursor - el->el_line.buffer); - (void)memcpy(vu->buf, el->el_line.buffer, size * sizeof(*vu->buf)); - - /* save command info for redo */ - r->count = el->el_state.doingarg ? el->el_state.argument : 0; - r->action = el->el_chared.c_vcmd.action; - r->pos = r->buf; - r->cmd = el->el_state.thiscmd; - r->ch = el->el_state.thisch; -} - -/* cv_yank(): - * Save yank/delete data for paste - */ -protected void -cv_yank(EditLine *el, const Char *ptr, int size) -{ - c_kill_t *k = &el->el_chared.c_kill; - - (void)memcpy(k->buf, ptr, (size_t)size * sizeof(*k->buf)); - k->last = k->buf + size; -} - - -/* c_insert(): - * Insert num characters - */ -protected void -c_insert(EditLine *el, int num) -{ - Char *cp; - - if (el->el_line.lastchar + num >= el->el_line.limit) { - if (!ch_enlargebufs(el, (size_t)num)) - return; /* can't go past end of buffer */ - } - - if (el->el_line.cursor < el->el_line.lastchar) { - /* if I must move chars */ - for (cp = el->el_line.lastchar; cp >= el->el_line.cursor; cp--) - cp[num] = *cp; - } - el->el_line.lastchar += num; -} - - -/* c_delafter(): - * Delete num characters after the cursor - */ -protected void -c_delafter(EditLine *el, int num) -{ - - if (el->el_line.cursor + num > el->el_line.lastchar) - num = (int)(el->el_line.lastchar - el->el_line.cursor); - - if (el->el_map.current != el->el_map.emacs) { - cv_undo(el); - cv_yank(el, el->el_line.cursor, num); - } - - if (num > 0) { - Char *cp; - - for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) - *cp = cp[num]; - - el->el_line.lastchar -= num; - } -} - - -/* c_delafter1(): - * Delete the character after the cursor, do not yank - */ -protected void -c_delafter1(EditLine *el) -{ - Char *cp; - - for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) - *cp = cp[1]; - - el->el_line.lastchar--; -} - - -/* c_delbefore(): - * Delete num characters before the cursor - */ -protected void -c_delbefore(EditLine *el, int num) -{ - - if (el->el_line.cursor - num < el->el_line.buffer) - num = (int)(el->el_line.cursor - el->el_line.buffer); - - if (el->el_map.current != el->el_map.emacs) { - cv_undo(el); - cv_yank(el, el->el_line.cursor - num, num); - } - - if (num > 0) { - Char *cp; - - for (cp = el->el_line.cursor - num; - cp <= el->el_line.lastchar; - cp++) - *cp = cp[num]; - - el->el_line.lastchar -= num; - } -} - - -/* c_delbefore1(): - * Delete the character before the cursor, do not yank - */ -protected void -c_delbefore1(EditLine *el) -{ - Char *cp; - - for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++) - *cp = cp[1]; - - el->el_line.lastchar--; -} - - -/* ce__isword(): - * Return if p is part of a word according to emacs - */ -protected int -ce__isword(Int p) -{ - return Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL; -} - - -/* cv__isword(): - * Return if p is part of a word according to vi - */ -protected int -cv__isword(Int p) -{ - if (Isalnum(p) || p == '_') - return 1; - if (Isgraph(p)) - return 2; - return 0; -} - - -/* cv__isWord(): - * Return if p is part of a big word according to vi - */ -protected int -cv__isWord(Int p) -{ - return !Isspace(p); -} - - -/* c__prev_word(): - * Find the previous word - */ -protected Char * -c__prev_word(Char *p, Char *low, int n, int (*wtest)(Int)) -{ - p--; - - while (n--) { - while ((p >= low) && !(*wtest)(*p)) - p--; - while ((p >= low) && (*wtest)(*p)) - p--; - } - - /* cp now points to one character before the word */ - p++; - if (p < low) - p = low; - /* cp now points where we want it */ - return p; -} - - -/* c__next_word(): - * Find the next word - */ -protected Char * -c__next_word(Char *p, Char *high, int n, int (*wtest)(Int)) -{ - while (n--) { - while ((p < high) && !(*wtest)(*p)) - p++; - while ((p < high) && (*wtest)(*p)) - p++; - } - if (p > high) - p = high; - /* p now points where we want it */ - return p; -} - -/* cv_next_word(): - * Find the next word vi style - */ -protected Char * -cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(Int)) -{ - int test; - - while (n--) { - test = (*wtest)(*p); - while ((p < high) && (*wtest)(*p) == test) - p++; - /* - * vi historically deletes with cw only the word preserving the - * trailing whitespace! This is not what 'w' does.. - */ - if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT)) - while ((p < high) && Isspace(*p)) - p++; - } - - /* p now points where we want it */ - if (p > high) - return high; - else - return p; -} - - -/* cv_prev_word(): - * Find the previous word vi style - */ -protected Char * -cv_prev_word(Char *p, Char *low, int n, int (*wtest)(Int)) -{ - int test; - - p--; - while (n--) { - while ((p > low) && Isspace(*p)) - p--; - test = (*wtest)(*p); - while ((p >= low) && (*wtest)(*p) == test) - p--; - } - p++; - - /* p now points where we want it */ - if (p < low) - return low; - else - return p; -} - - -/* cv_delfini(): - * Finish vi delete action - */ -protected void -cv_delfini(EditLine *el) -{ - int size; - int action = el->el_chared.c_vcmd.action; - - if (action & INSERT) - el->el_map.current = el->el_map.key; - - if (el->el_chared.c_vcmd.pos == 0) - /* sanity */ - return; - - size = (int)(el->el_line.cursor - el->el_chared.c_vcmd.pos); - if (size == 0) - size = 1; - el->el_line.cursor = el->el_chared.c_vcmd.pos; - if (action & YANK) { - if (size > 0) - cv_yank(el, el->el_line.cursor, size); - else - cv_yank(el, el->el_line.cursor + size, -size); - } else { - if (size > 0) { - c_delafter(el, size); - re_refresh_cursor(el); - } else { - c_delbefore(el, -size); - el->el_line.cursor += size; - } - } - el->el_chared.c_vcmd.action = NOP; -} - - -/* cv__endword(): - * Go to the end of this word according to vi - */ -protected Char * -cv__endword(Char *p, Char *high, int n, int (*wtest)(Int)) -{ - int test; - - p++; - - while (n--) { - while ((p < high) && Isspace(*p)) - p++; - - test = (*wtest)(*p); - while ((p < high) && (*wtest)(*p) == test) - p++; - } - p--; - return p; -} - -/* ch_init(): - * Initialize the character editor - */ -protected int -ch_init(EditLine *el) -{ - c_macro_t *ma = &el->el_chared.c_macro; - - el->el_line.buffer = el_malloc(EL_BUFSIZ * - sizeof(*el->el_line.buffer)); - if (el->el_line.buffer == NULL) - return -1; - - (void) memset(el->el_line.buffer, 0, EL_BUFSIZ * - sizeof(*el->el_line.buffer)); - el->el_line.cursor = el->el_line.buffer; - el->el_line.lastchar = el->el_line.buffer; - el->el_line.limit = &el->el_line.buffer[EL_BUFSIZ - EL_LEAVE]; - - el->el_chared.c_undo.buf = el_malloc(EL_BUFSIZ * - sizeof(*el->el_chared.c_undo.buf)); - if (el->el_chared.c_undo.buf == NULL) - return -1; - (void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ * - sizeof(*el->el_chared.c_undo.buf)); - el->el_chared.c_undo.len = -1; - el->el_chared.c_undo.cursor = 0; - el->el_chared.c_redo.buf = el_malloc(EL_BUFSIZ * - sizeof(*el->el_chared.c_redo.buf)); - if (el->el_chared.c_redo.buf == NULL) - return -1; - el->el_chared.c_redo.pos = el->el_chared.c_redo.buf; - el->el_chared.c_redo.lim = el->el_chared.c_redo.buf + EL_BUFSIZ; - el->el_chared.c_redo.cmd = ED_UNASSIGNED; - - el->el_chared.c_vcmd.action = NOP; - el->el_chared.c_vcmd.pos = el->el_line.buffer; - - el->el_chared.c_kill.buf = el_malloc(EL_BUFSIZ * - sizeof(*el->el_chared.c_kill.buf)); - if (el->el_chared.c_kill.buf == NULL) - return -1; - (void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ * - sizeof(*el->el_chared.c_kill.buf)); - el->el_chared.c_kill.mark = el->el_line.buffer; - el->el_chared.c_kill.last = el->el_chared.c_kill.buf; - el->el_chared.c_resizefun = NULL; - el->el_chared.c_resizearg = NULL; - - el->el_map.current = el->el_map.key; - - el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */ - el->el_state.doingarg = 0; - el->el_state.metanext = 0; - el->el_state.argument = 1; - el->el_state.lastcmd = ED_UNASSIGNED; - - ma->level = -1; - ma->offset = 0; - ma->macro = el_malloc(EL_MAXMACRO * sizeof(*ma->macro)); - if (ma->macro == NULL) - return -1; - return 0; -} - -/* ch_reset(): - * Reset the character editor - */ -protected void -ch_reset(EditLine *el, int mclear) -{ - el->el_line.cursor = el->el_line.buffer; - el->el_line.lastchar = el->el_line.buffer; - - el->el_chared.c_undo.len = -1; - el->el_chared.c_undo.cursor = 0; - - el->el_chared.c_vcmd.action = NOP; - el->el_chared.c_vcmd.pos = el->el_line.buffer; - - el->el_chared.c_kill.mark = el->el_line.buffer; - - el->el_map.current = el->el_map.key; - - el->el_state.inputmode = MODE_INSERT; /* XXX: save a default */ - el->el_state.doingarg = 0; - el->el_state.metanext = 0; - el->el_state.argument = 1; - el->el_state.lastcmd = ED_UNASSIGNED; - - el->el_history.eventno = 0; - - if (mclear) - ch__clearmacro(el); -} - -private void -ch__clearmacro(EditLine *el) -{ - c_macro_t *ma = &el->el_chared.c_macro; - while (ma->level >= 0) - el_free(ma->macro[ma->level--]); -} - -/* ch_enlargebufs(): - * Enlarge line buffer to be able to hold twice as much characters. - * Returns 1 if successful, 0 if not. - */ -protected int -ch_enlargebufs(EditLine *el, size_t addlen) -{ - size_t sz, newsz; - Char *newbuffer, *oldbuf, *oldkbuf; - - sz = (size_t)(el->el_line.limit - el->el_line.buffer + EL_LEAVE); - newsz = sz * 2; - /* - * If newly required length is longer than current buffer, we need - * to make the buffer big enough to hold both old and new stuff. - */ - if (addlen > sz) { - while(newsz - sz < addlen) - newsz *= 2; - } - - /* - * Reallocate line buffer. - */ - newbuffer = el_realloc(el->el_line.buffer, newsz * sizeof(*newbuffer)); - if (!newbuffer) - return 0; - - /* zero the newly added memory, leave old data in */ - (void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); - - oldbuf = el->el_line.buffer; - - el->el_line.buffer = newbuffer; - el->el_line.cursor = newbuffer + (el->el_line.cursor - oldbuf); - el->el_line.lastchar = newbuffer + (el->el_line.lastchar - oldbuf); - /* don't set new size until all buffers are enlarged */ - el->el_line.limit = &newbuffer[sz - EL_LEAVE]; - - /* - * Reallocate kill buffer. - */ - newbuffer = el_realloc(el->el_chared.c_kill.buf, newsz * - sizeof(*newbuffer)); - if (!newbuffer) - return 0; - - /* zero the newly added memory, leave old data in */ - (void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); - - oldkbuf = el->el_chared.c_kill.buf; - - el->el_chared.c_kill.buf = newbuffer; - el->el_chared.c_kill.last = newbuffer + - (el->el_chared.c_kill.last - oldkbuf); - el->el_chared.c_kill.mark = el->el_line.buffer + - (el->el_chared.c_kill.mark - oldbuf); - - /* - * Reallocate undo buffer. - */ - newbuffer = el_realloc(el->el_chared.c_undo.buf, - newsz * sizeof(*newbuffer)); - if (!newbuffer) - return 0; - - /* zero the newly added memory, leave old data in */ - (void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); - el->el_chared.c_undo.buf = newbuffer; - - newbuffer = el_realloc(el->el_chared.c_redo.buf, - newsz * sizeof(*newbuffer)); - if (!newbuffer) - return 0; - el->el_chared.c_redo.pos = newbuffer + - (el->el_chared.c_redo.pos - el->el_chared.c_redo.buf); - el->el_chared.c_redo.lim = newbuffer + - (el->el_chared.c_redo.lim - el->el_chared.c_redo.buf); - el->el_chared.c_redo.buf = newbuffer; - - if (!hist_enlargebuf(el, sz, newsz)) - return 0; - - /* Safe to set enlarged buffer size */ - el->el_line.limit = &el->el_line.buffer[newsz - EL_LEAVE]; - if (el->el_chared.c_resizefun) - (*el->el_chared.c_resizefun)(el, el->el_chared.c_resizearg); - return 1; -} - -/* ch_end(): - * Free the data structures used by the editor - */ -protected void -ch_end(EditLine *el) -{ - el_free(el->el_line.buffer); - el->el_line.buffer = NULL; - el->el_line.limit = NULL; - el_free(el->el_chared.c_undo.buf); - el->el_chared.c_undo.buf = NULL; - el_free(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(el->el_chared.c_kill.buf); - el->el_chared.c_kill.buf = NULL; - ch_reset(el, 1); - el_free(el->el_chared.c_macro.macro); - el->el_chared.c_macro.macro = NULL; -} - - -/* el_insertstr(): - * Insert string at cursorI - */ -public int -FUN(el,insertstr)(EditLine *el, const Char *s) -{ - size_t len; - - if ((len = Strlen(s)) == 0) - return -1; - if (el->el_line.lastchar + len >= el->el_line.limit) { - if (!ch_enlargebufs(el, len)) - return -1; - } - - c_insert(el, (int)len); - while (*s) - *el->el_line.cursor++ = *s++; - return 0; -} - - -/* el_deletestr(): - * Delete num characters before the cursor - */ -public void -el_deletestr(EditLine *el, int n) -{ - if (n <= 0) - return; - - if (el->el_line.cursor < &el->el_line.buffer[n]) - return; - - c_delbefore(el, n); /* delete before dot */ - el->el_line.cursor -= n; - if (el->el_line.cursor < el->el_line.buffer) - el->el_line.cursor = el->el_line.buffer; -} - -/* c_gets(): - * Get a string - */ -protected int -c_gets(EditLine *el, Char *buf, const Char *prompt) -{ - Char ch; - ssize_t len; - Char *cp = el->el_line.buffer; - - if (prompt) { - len = (ssize_t)Strlen(prompt); - (void)memcpy(cp, prompt, (size_t)len * sizeof(*cp)); - cp += len; - } - len = 0; - - for (;;) { - el->el_line.cursor = cp; - *cp = ' '; - el->el_line.lastchar = cp + 1; - re_refresh(el); - - if (FUN(el,getc)(el, &ch) != 1) { - ed_end_of_file(el, 0); - len = -1; - break; - } - - switch (ch) { - - case 0010: /* Delete and backspace */ - case 0177: - if (len == 0) { - len = -1; - break; - } - cp--; - continue; - - case 0033: /* ESC */ - case '\r': /* Newline */ - case '\n': - buf[len] = ch; - break; - - default: - if (len >= (ssize_t)(EL_BUFSIZ - 16)) - terminal_beep(el); - else { - buf[len++] = ch; - *cp++ = ch; - } - continue; - } - break; - } - - el->el_line.buffer[0] = '\0'; - el->el_line.lastchar = el->el_line.buffer; - el->el_line.cursor = el->el_line.buffer; - return (int)len; -} - - -/* c_hpos(): - * Return the current horizontal position of the cursor - */ -protected int -c_hpos(EditLine *el) -{ - Char *ptr; - - /* - * Find how many characters till the beginning of this line. - */ - if (el->el_line.cursor == el->el_line.buffer) - return 0; - else { - for (ptr = el->el_line.cursor - 1; - ptr >= el->el_line.buffer && *ptr != '\n'; - ptr--) - continue; - return (int)(el->el_line.cursor - ptr - 1); - } -} - -protected int -ch_resizefun(EditLine *el, el_zfunc_t f, void *a) -{ - el->el_chared.c_resizefun = f; - el->el_chared.c_resizearg = a; - return 0; -} diff --git a/cmd-line-utils/libedit/chared.h b/cmd-line-utils/libedit/chared.h deleted file mode 100644 index 176475ac8f0..00000000000 --- a/cmd-line-utils/libedit/chared.h +++ /dev/null @@ -1,171 +0,0 @@ -/* $NetBSD: chared.h,v 1.21 2010/08/28 15:44:59 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)chared.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.chared.h: Character editor interface - */ -#ifndef _h_el_chared -#define _h_el_chared - -#include -#include - -#include "histedit.h" - -#define EL_MAXMACRO 10 - -/* - * This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works - * like real vi: i.e. the transition from command<->insert modes moves - * the cursor. - * - * On the other hand we really don't want to move the cursor, because - * all the editing commands don't include the character under the cursor. - * Probably the best fix is to make all the editing commands aware of - * this fact. - */ -#define VI_MOVE - - -typedef struct c_macro_t { - int level; - int offset; - Char **macro; -} c_macro_t; - -/* - * Undo information for vi - no undo in emacs (yet) - */ -typedef struct c_undo_t { - ssize_t len; /* length of saved line */ - int cursor; /* position of saved cursor */ - Char *buf; /* full saved text */ -} c_undo_t; - -/* redo for vi */ -typedef struct c_redo_t { - Char *buf; /* redo insert key sequence */ - Char *pos; - Char *lim; - el_action_t cmd; /* command to redo */ - Char ch; /* char that invoked it */ - int count; - int action; /* from cv_action() */ -} c_redo_t; - -/* - * Current action information for vi - */ -typedef struct c_vcmd_t { - int action; - Char *pos; -} c_vcmd_t; - -/* - * Kill buffer for emacs - */ -typedef struct c_kill_t { - Char *buf; - Char *last; - Char *mark; -} c_kill_t; - -typedef void (*el_zfunc_t)(EditLine *, void *); - -/* - * Note that we use both data structures because the user can bind - * commands from both editors! - */ -typedef struct el_chared_t { - c_undo_t c_undo; - c_kill_t c_kill; - c_redo_t c_redo; - c_vcmd_t c_vcmd; - c_macro_t c_macro; - el_zfunc_t c_resizefun; - void * c_resizearg; -} el_chared_t; - - -#define STRQQ "\"\"" - -#define isglob(a) (strchr("*[]?", (a)) != NULL) - -#define NOP 0x00 -#define DELETE 0x01 -#define INSERT 0x02 -#define YANK 0x04 - -#define CHAR_FWD (+1) -#define CHAR_BACK (-1) - -#define MODE_INSERT 0 -#define MODE_REPLACE 1 -#define MODE_REPLACE_1 2 - -#include "common.h" -#include "vi.h" -#include "emacs.h" -#include "search.h" -#include "fcns.h" - - -protected int cv__isword(Int); -protected int cv__isWord(Int); -protected void cv_delfini(EditLine *); -protected Char *cv__endword(Char *, Char *, int, int (*)(Int)); -protected int ce__isword(Int); -protected void cv_undo(EditLine *); -protected void cv_yank(EditLine *, const Char *, int); -protected Char *cv_next_word(EditLine*, Char *, Char *, int, int (*)(Int)); -protected Char *cv_prev_word(Char *, Char *, int, int (*)(Int)); -protected Char *c__next_word(Char *, Char *, int, int (*)(Int)); -protected Char *c__prev_word(Char *, Char *, int, int (*)(Int)); -protected void c_insert(EditLine *, int); -protected void c_delbefore(EditLine *, int); -protected void c_delbefore1(EditLine *); -protected void c_delafter(EditLine *, int); -protected void c_delafter1(EditLine *); -protected int c_gets(EditLine *, Char *, const Char *); -protected int c_hpos(EditLine *); - -protected int ch_init(EditLine *); -protected void ch_reset(EditLine *, int); -protected int ch_resizefun(EditLine *, el_zfunc_t, void *); -protected int ch_enlargebufs(EditLine *, size_t); -protected void ch_end(EditLine *); - -#endif /* _h_el_chared */ diff --git a/cmd-line-utils/libedit/chartype.c b/cmd-line-utils/libedit/chartype.c deleted file mode 100644 index b70aebeec46..00000000000 --- a/cmd-line-utils/libedit/chartype.c +++ /dev/null @@ -1,361 +0,0 @@ -/* $NetBSD: chartype.c,v 1.10 2011/08/16 16:25:15 christos Exp $ */ - -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * chartype.c: character classification and meta information - */ -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#endif /* not lint && not SCCSID */ -#include "el.h" -#include - -#define CT_BUFSIZ ((size_t)1024) - -#ifdef WIDECHAR -protected void -ct_conv_buff_resize(ct_buffer_t *conv, size_t mincsize, size_t minwsize) -{ - void *p; - if (mincsize > conv->csize) { - conv->csize = mincsize; - p = el_realloc(conv->cbuff, conv->csize * sizeof(*conv->cbuff)); - if (p == NULL) { - conv->csize = 0; - el_free(conv->cbuff); - conv->cbuff = NULL; - } else - conv->cbuff = p; - } - - if (minwsize > conv->wsize) { - conv->wsize = minwsize; - p = el_realloc(conv->wbuff, conv->wsize * sizeof(*conv->wbuff)); - if (p == NULL) { - conv->wsize = 0; - el_free(conv->wbuff); - conv->wbuff = NULL; - } else - conv->wbuff = p; - } -} - - -public char * -ct_encode_string(const Char *s, ct_buffer_t *conv) -{ - char *dst; - ssize_t used = 0; - mbstate_t state; - - memset(&state, 0, sizeof(mbstate_t)); - - if (!s) - return NULL; - if (!conv->cbuff) - ct_conv_buff_resize(conv, CT_BUFSIZ, (size_t)0); - if (!conv->cbuff) - return NULL; - - dst = conv->cbuff; - while (*s) { - used = (ssize_t)(conv->csize - (size_t)(dst - conv->cbuff)); - if (used < 5) { - used = dst - conv->cbuff; - ct_conv_buff_resize(conv, conv->csize + CT_BUFSIZ, - (size_t)0); - if (!conv->cbuff) - return NULL; - dst = conv->cbuff + used; - } - used = ct_encode_char(dst, (size_t)5, *s, &state); - if (used == -1) /* failed to encode, need more buffer space */ - abort(); - ++s; - dst += used; - } - *dst = '\0'; - return conv->cbuff; -} - -public Char * -ct_decode_string(const char *s, ct_buffer_t *conv) -{ - size_t len = 0; - - if (!s) - return NULL; - if (!conv->wbuff) - ct_conv_buff_resize(conv, (size_t)0, CT_BUFSIZ); - if (!conv->wbuff) - return NULL; - - len = ct_mbstowcs(NULL, s, (size_t)0); - if (len == (size_t)-1) - return NULL; - if (len > conv->wsize) - ct_conv_buff_resize(conv, (size_t)0, len + 1); - if (!conv->wbuff) - return NULL; - ct_mbstowcs(conv->wbuff, s, conv->wsize); - return conv->wbuff; -} - - -protected Char ** -ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv) -{ - size_t bufspace; - int i; - Char *p; - Char **wargv; - ssize_t bytes; - mbstate_t state; - - /* Make sure we have enough space in the conversion buffer to store all - * the argv strings. */ - for (i = 0, bufspace = 0; i < argc; ++i) - bufspace += argv[i] ? strlen(argv[i]) + 1 : 0; - ct_conv_buff_resize(conv, (size_t)0, bufspace); - if (!conv->wsize) - return NULL; - - wargv = el_malloc((size_t)argc * sizeof(*wargv)); - - for (i = 0, p = conv->wbuff; i < argc; ++i) { - if (!argv[i]) { /* don't pass null pointers to mbsrtowcs */ - wargv[i] = NULL; - continue; - } else { - wargv[i] = p; - memset(&state, 0, sizeof(mbstate_t)); - bytes = (ssize_t)mbsrtowcs(p, argv + i, bufspace, &state); - } - if (bytes == -1) { - el_free(wargv); - return NULL; - } else - bytes++; /* include '\0' in the count */ - bufspace -= (size_t)bytes; - p += bytes; - } - - return wargv; -} - - -protected size_t -ct_enc_width(Char c) -{ - /* UTF-8 encoding specific values */ - if (c < 0x80) - return 1; - else if (c < 0x0800) - return 2; - else if (c < 0x10000) - return 3; - else if (c < 0x110000) - return 4; - else - return 0; /* not a valid codepoint */ -} - -protected ssize_t -ct_encode_char(char *dst, size_t len, Char c, mbstate_t *state) -{ - ssize_t l = 0; - - if (len < ct_enc_width(c)) - return -1; - - l = wcrtomb(dst, c, state); - - if (l < 0) { - memset (state, 0, sizeof (mbstate_t)); - l = 0; - } - return l; -} -#endif - -protected const Char * -ct_visual_string(const Char *s) -{ - static Char *buff = NULL; - static size_t buffsize = 0; - void *p; - Char *dst; - ssize_t used = 0; - - if (!s) - return NULL; - if (!buff) { - buffsize = CT_BUFSIZ; - buff = el_malloc(buffsize * sizeof(*buff)); - } - dst = buff; - while (*s) { - used = ct_visual_char(dst, buffsize - (size_t)(dst - buff), *s); - if (used == -1) { /* failed to encode, need more buffer space */ - used = dst - buff; - buffsize += CT_BUFSIZ; - p = el_realloc(buff, buffsize * sizeof(*buff)); - if (p == NULL) - goto out; - buff = p; - dst = buff + used; - /* don't increment s here - we want to retry it! */ - } - else - ++s; - dst += used; - } - if (dst >= (buff + buffsize)) { /* sigh */ - buffsize += 1; - p = el_realloc(buff, buffsize * sizeof(*buff)); - if (p == NULL) - goto out; - buff = p; - dst = buff + buffsize - 1; - } - *dst = 0; - return buff; -out: - el_free(buff); - buffsize = 0; - return NULL; -} - - -protected int -ct_visual_width(Char c) -{ - int t = ct_chr_class(c); - switch (t) { - case CHTYPE_ASCIICTL: - return 2; /* ^@ ^? etc. */ - case CHTYPE_TAB: - return 1; /* Hmm, this really need to be handled outside! */ - case CHTYPE_NL: - return 0; /* Should this be 1 instead? */ -#ifdef WIDECHAR - case CHTYPE_PRINT: - return wcwidth(c); - case CHTYPE_NONPRINT: - if (c > 0xffff) /* prefer standard 4-byte display over 5-byte */ - return 8; /* \U+12345 */ - else - return 7; /* \U+1234 */ -#else - case CHTYPE_PRINT: - return 1; - case CHTYPE_NONPRINT: - return 4; /* \123 */ -#endif - default: - return 0; /* should not happen */ - } -} - - -protected ssize_t -ct_visual_char(Char *dst, size_t len, Char c) -{ - int t = ct_chr_class(c); - switch (t) { - case CHTYPE_TAB: - case CHTYPE_NL: - case CHTYPE_ASCIICTL: - if (len < 2) - return -1; /* insufficient space */ - *dst++ = '^'; - if (c == '\177') - *dst = '?'; /* DEL -> ^? */ - else - *dst = c | 0100; /* uncontrolify it */ - return 2; - case CHTYPE_PRINT: - if (len < 1) - return -1; /* insufficient space */ - *dst = c; - return 1; - case CHTYPE_NONPRINT: - /* we only use single-width glyphs for display, - * so this is right */ - if ((ssize_t)len < ct_visual_width(c)) - return -1; /* insufficient space */ -#ifdef WIDECHAR - *dst++ = '\\'; - *dst++ = 'U'; - *dst++ = '+'; -#define tohexdigit(v) "0123456789ABCDEF"[v] - if (c > 0xffff) /* prefer standard 4-byte display over 5-byte */ - *dst++ = tohexdigit(((unsigned int) c >> 16) & 0xf); - *dst++ = tohexdigit(((unsigned int) c >> 12) & 0xf); - *dst++ = tohexdigit(((unsigned int) c >> 8) & 0xf); - *dst++ = tohexdigit(((unsigned int) c >> 4) & 0xf); - *dst = tohexdigit(((unsigned int) c ) & 0xf); - return c > 0xffff ? 8 : 7; -#else - *dst++ = '\\'; -#define tooctaldigit(v) ((v) + '0') - *dst++ = tooctaldigit(((unsigned int) c >> 6) & 0x7); - *dst++ = tooctaldigit(((unsigned int) c >> 3) & 0x7); - *dst++ = tooctaldigit(((unsigned int) c ) & 0x7); -#endif - /*FALLTHROUGH*/ - /* these two should be handled outside this function */ - default: /* we should never hit the default */ - return 0; - } -} - - - - -protected int -ct_chr_class(Char c) -{ - if (c == '\t') - return CHTYPE_TAB; - else if (c == '\n') - return CHTYPE_NL; - else if (IsASCII(c) && Iscntrl(c)) - return CHTYPE_ASCIICTL; - else if (Isprint(c)) - return CHTYPE_PRINT; - else - return CHTYPE_NONPRINT; -} diff --git a/cmd-line-utils/libedit/chartype.h b/cmd-line-utils/libedit/chartype.h deleted file mode 100644 index 576abe13ad5..00000000000 --- a/cmd-line-utils/libedit/chartype.h +++ /dev/null @@ -1,252 +0,0 @@ -/* $NetBSD: chartype.h,v 1.8 2011/07/29 23:44:44 christos Exp $ */ - -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _h_chartype_f -#define _h_chartype_f - - - -#ifdef WIDECHAR - -/* Ideally we should also test the value of the define to see if it - * supports non-BMP code points without requiring UTF-16, but nothing - * seems to actually advertise this properly, despite Unicode 3.1 having - * been around since 2001... */ - -/* XXXMYSQL : Added FreeBSD & AIX to bypass this check. - TODO : Verify if FreeBSD & AIX stores ISO 10646 in wchar_t. */ -#if !defined(__NetBSD__) && !defined(__sun) \ - && !(defined(__APPLE__) && defined(__MACH__)) \ - && !defined(__FreeBSD__) && !defined(_AIX) && !defined(__OpenBSD__) -#ifndef __STDC_ISO_10646__ -/* In many places it is assumed that the first 127 code points are ASCII - * compatible, so ensure wchar_t indeed does ISO 10646 and not some other - * funky encoding that could break us in weird and wonderful ways. */ - #error wchar_t must store ISO 10646 characters -#endif -#endif - -/* Oh for a with char32_t and __STDC_UTF_32__ in it... - * ref: ISO/IEC DTR 19769 - */ -#if WCHAR_MAX < INT32_MAX -#warning Build environment does not support non-BMP characters -#endif - -#ifndef HAVE_WCSDUP -wchar_t *wcsdup(const wchar_t *s); -#endif - -#define ct_wctomb wctomb -#define ct_wctomb_reset wctomb(0,0) -#define ct_wcstombs wcstombs -#define ct_mbstowcs mbstowcs - -#define Char wchar_t -#define Int wint_t -#define FUN(prefix,rest) prefix ## _w ## rest -#define FUNW(type) type ## _w -#define TYPE(type) type ## W -#define FSTR "%ls" -#define STR(x) L ## x -#define UC(c) c -#define Isalpha(x) iswalpha(x) -#define Isalnum(x) iswalnum(x) -#define Isgraph(x) iswgraph(x) -#define Isspace(x) iswspace(x) -#define Isdigit(x) iswdigit(x) -#define Iscntrl(x) iswcntrl(x) -#define Isprint(x) iswprint(x) - -#define Isupper(x) iswupper(x) -#define Islower(x) iswlower(x) -#define Toupper(x) towupper(x) -#define Tolower(x) towlower(x) - -#define IsASCII(x) (x < 0x100) - -#define Strlen(x) wcslen(x) -#define Strchr(s,c) wcschr(s,c) -#define Strrchr(s,c) wcsrchr(s,c) -#define Strstr(s,v) wcsstr(s,v) -#define Strdup(x) wcsdup(x) -#define Strcpy(d,s) wcscpy(d,s) -#define Strncpy(d,s,n) wcsncpy(d,s,n) -#define Strncat(d,s,n) wcsncat(d,s,n) - -#define Strcmp(s,v) wcscmp(s,v) -#define Strncmp(s,v,n) wcsncmp(s,v,n) -#define Strcspn(s,r) wcscspn(s,r) - -#define Strtol(p,e,b) wcstol(p,e,b) - -#define Width(c) wcwidth(c) - -#else /* NARROW */ - -#define ct_mbtowc error -#define ct_mbtowc_reset -#define ct_wctomb error -#define ct_wctomb_reset -#define ct_wcstombs(a, b, c) (strncpy(a, b, c), strlen(a)) -#define ct_mbstowcs(a, b, c) (strncpy(a, b, c), strlen(a)) - -#define Char char -#define Int int -#define FUN(prefix,rest) prefix ## _ ## rest -#define FUNW(type) type -#define TYPE(type) type -#define FSTR "%s" -#define STR(x) x -#define UC(c) (unsigned char)(c) - -#define Isalpha(x) isalpha((unsigned char)x) -#define Isalnum(x) isalnum((unsigned char)x) -#define Isgraph(x) isgraph((unsigned char)x) -#define Isspace(x) isspace((unsigned char)x) -#define Isdigit(x) isdigit((unsigned char)x) -#define Iscntrl(x) iscntrl((unsigned char)x) -#define Isprint(x) isprint((unsigned char)x) - -#define Isupper(x) isupper((unsigned char)x) -#define Islower(x) islower((unsigned char)x) -#define Toupper(x) toupper((unsigned char)x) -#define Tolower(x) tolower((unsigned char)x) - -#define IsASCII(x) isascii((unsigned char)x) - -#define Strlen(x) strlen(x) -#define Strchr(s,c) strchr(s,c) -#define Strrchr(s,c) strrchr(s,c) -#define Strstr(s,v) strstr(s,v) -#define Strdup(x) strdup(x) -#define Strcpy(d,s) strcpy(d,s) -#define Strncpy(d,s,n) strncpy(d,s,n) -#define Strncat(d,s,n) strncat(d,s,n) - -#define Strcmp(s,v) strcmp(s,v) -#define Strncmp(s,v,n) strncmp(s,v,n) -#define Strcspn(s,r) strcspn(s,r) - -#define Strtol(p,e,b) strtol(p,e,b) - -#define Width(c) 1 - -#endif - - -#ifdef WIDECHAR -/* - * Conversion buffer - */ -typedef struct ct_buffer_t { - char *cbuff; - size_t csize; - Char *wbuff; - size_t wsize; -} ct_buffer_t; - -#define ct_encode_string __ct_encode_string -/* Encode a wide-character string and return the UTF-8 encoded result. */ -public char *ct_encode_string(const Char *, ct_buffer_t *); - -#define ct_decode_string __ct_decode_string -/* Decode a (multi)?byte string and return the wide-character string result. */ -public Char *ct_decode_string(const char *, ct_buffer_t *); - -/* Decode a (multi)?byte argv string array. - * The pointer returned must be free()d when done. */ -protected Char **ct_decode_argv(int, const char *[], ct_buffer_t *); - -/* Resizes the conversion buffer(s) if needed. */ -protected void ct_conv_buff_resize(ct_buffer_t *, size_t, size_t); -protected ssize_t ct_encode_char(char *, size_t, Char, mbstate_t *); -protected size_t ct_enc_width(Char); - -#define ct_free_argv(s) el_free(s) - -#else -#define ct_encode_string(s, b) (s) -#define ct_decode_string(s, b) (s) -#define ct_decode_argv(l, s, b) (s) -#define ct_conv_buff_resize(b, os, ns) -#define ct_encode_char(d, l, s, ps) (*d = s, 1) -#define ct_free_argv(s) -#endif - -#ifndef NARROWCHAR -/* Encode a characted into the destination buffer, provided there is sufficent - * buffer space available. Returns the number of bytes used up (zero if the - * character cannot be encoded, -1 if there was not enough space available). */ - -/* The maximum buffer size to hold the most unwieldly visual representation, - * in this case \U+nnnnn. */ -#define VISUAL_WIDTH_MAX ((size_t)8) - -/* The terminal is thought of in terms of X columns by Y lines. In the cases - * where a wide character takes up more than one column, the adjacent - * occupied column entries will contain this faux character. */ -#define MB_FILL_CHAR ((Char)-1) - -/* Visual width of character c, taking into account ^? , \0177 and \U+nnnnn - * style visual expansions. */ -protected int ct_visual_width(Char); - -/* Turn the given character into the appropriate visual format, matching - * the width given by ct_visual_width(). Returns the number of characters used - * up, or -1 if insufficient space. Buffer length is in count of Char's. */ -protected ssize_t ct_visual_char(Char *, size_t, Char); - -/* Convert the given string into visual format, using the ct_visual_char() - * function. Uses a static buffer, so not threadsafe. */ -protected const Char *ct_visual_string(const Char *); - - -/* printable character, use ct_visual_width() to find out display width */ -#define CHTYPE_PRINT ( 0) -/* control character found inside the ASCII portion of the charset */ -#define CHTYPE_ASCIICTL (-1) -/* a \t */ -#define CHTYPE_TAB (-2) -/* a \n */ -#define CHTYPE_NL (-3) -/* non-printable character */ -#define CHTYPE_NONPRINT (-4) -/* classification of character c, as one of the above defines */ -protected int ct_chr_class(Char c); -#endif - - -#endif /* _chartype_f */ diff --git a/cmd-line-utils/libedit/common.c b/cmd-line-utils/libedit/common.c deleted file mode 100644 index c0512061e6f..00000000000 --- a/cmd-line-utils/libedit/common.c +++ /dev/null @@ -1,921 +0,0 @@ -/* $NetBSD: common.c,v 1.28 2011/07/29 20:58:07 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * common.c: Common Editor functions - */ -#include "el.h" - -/* ed_end_of_file(): - * Indicate end of file - * [^D] - */ -protected el_action_t -/*ARGSUSED*/ -ed_end_of_file(EditLine *el, Int c __attribute__((__unused__))) -{ - - re_goto_bottom(el); - *el->el_line.lastchar = '\0'; - return CC_EOF; -} - - -/* ed_insert(): - * Add character to the line - * Insert a character [bound to all insert keys] - */ -protected el_action_t -ed_insert(EditLine *el, Int c) -{ - int count = el->el_state.argument; - - if (c == '\0') - return CC_ERROR; - - if (el->el_line.lastchar + el->el_state.argument >= - el->el_line.limit) { - /* end of buffer space, try to allocate more */ - if (!ch_enlargebufs(el, (size_t) count)) - return CC_ERROR; /* error allocating more */ - } - - if (count == 1) { - if (el->el_state.inputmode == MODE_INSERT - || el->el_line.cursor >= el->el_line.lastchar) - c_insert(el, 1); - - *el->el_line.cursor++ = c; - re_fastaddc(el); /* fast refresh for one char. */ - } else { - if (el->el_state.inputmode != MODE_REPLACE_1) - c_insert(el, el->el_state.argument); - - while (count-- && el->el_line.cursor < el->el_line.lastchar) - *el->el_line.cursor++ = c; - re_refresh(el); - } - - if (el->el_state.inputmode == MODE_REPLACE_1) - return vi_command_mode(el, 0); - - return CC_NORM; -} - - -/* ed_delete_prev_word(): - * Delete from beginning of current word to cursor - * [M-^?] [^W] - */ -protected el_action_t -/*ARGSUSED*/ -ed_delete_prev_word(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *cp, *p, *kp; - - if (el->el_line.cursor == el->el_line.buffer) - return CC_ERROR; - - cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, - el->el_state.argument, ce__isword); - - for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++) - *kp++ = *p; - el->el_chared.c_kill.last = kp; - - c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */ - el->el_line.cursor = cp; - if (el->el_line.cursor < el->el_line.buffer) - el->el_line.cursor = el->el_line.buffer; /* bounds check */ - return CC_REFRESH; -} - - -/* ed_delete_next_char(): - * Delete character under cursor - * [^D] [x] - */ -protected el_action_t -/*ARGSUSED*/ -ed_delete_next_char(EditLine *el, Int c __attribute__((__unused__))) -{ -#ifdef DEBUG_EDIT -#define EL el->el_line - (void) fprintf(el->el_errlfile, - "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", - EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, - EL.lastchar, EL.limit, EL.limit); -#endif - if (el->el_line.cursor == el->el_line.lastchar) { - /* if I'm at the end */ - if (el->el_map.type == MAP_VI) { - if (el->el_line.cursor == el->el_line.buffer) { - /* if I'm also at the beginning */ -#ifdef KSHVI - return CC_ERROR; -#else - /* then do an EOF */ - terminal_writec(el, c); - return CC_EOF; -#endif - } else { -#ifdef KSHVI - el->el_line.cursor--; -#else - return CC_ERROR; -#endif - } - } else { - if (el->el_line.cursor != el->el_line.buffer) - el->el_line.cursor--; - else - return CC_ERROR; - } - } - c_delafter(el, el->el_state.argument); /* delete after dot */ - if (el->el_line.cursor >= el->el_line.lastchar && - el->el_line.cursor > el->el_line.buffer) - /* bounds check */ - el->el_line.cursor = el->el_line.lastchar - 1; - return CC_REFRESH; -} - - -/* ed_kill_line(): - * Cut to the end of line - * [^K] [^K] - */ -protected el_action_t -/*ARGSUSED*/ -ed_kill_line(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *kp, *cp; - - cp = el->el_line.cursor; - kp = el->el_chared.c_kill.buf; - while (cp < el->el_line.lastchar) - *kp++ = *cp++; /* copy it */ - el->el_chared.c_kill.last = kp; - /* zap! -- delete to end */ - el->el_line.lastchar = el->el_line.cursor; - return CC_REFRESH; -} - - -/* ed_move_to_end(): - * Move cursor to the end of line - * [^E] [^E] - */ -protected el_action_t -/*ARGSUSED*/ -ed_move_to_end(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_line.cursor = el->el_line.lastchar; - if (el->el_map.type == MAP_VI) { - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } -#ifdef VI_MOVE - el->el_line.cursor--; -#endif - } - return CC_CURSOR; -} - - -/* ed_move_to_beg(): - * Move cursor to the beginning of line - * [^A] [^A] - */ -protected el_action_t -/*ARGSUSED*/ -ed_move_to_beg(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_line.cursor = el->el_line.buffer; - - if (el->el_map.type == MAP_VI) { - /* We want FIRST non space character */ - while (Isspace(*el->el_line.cursor)) - el->el_line.cursor++; - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - } - return CC_CURSOR; -} - - -/* ed_transpose_chars(): - * Exchange the character to the left of the cursor with the one under it - * [^T] [^T] - */ -protected el_action_t -ed_transpose_chars(EditLine *el, Int c) -{ - - if (el->el_line.cursor < el->el_line.lastchar) { - if (el->el_line.lastchar <= &el->el_line.buffer[1]) - return CC_ERROR; - else - el->el_line.cursor++; - } - if (el->el_line.cursor > &el->el_line.buffer[1]) { - /* must have at least two chars entered */ - c = el->el_line.cursor[-2]; - el->el_line.cursor[-2] = el->el_line.cursor[-1]; - el->el_line.cursor[-1] = c; - return CC_REFRESH; - } else - return CC_ERROR; -} - - -/* ed_next_char(): - * Move to the right one character - * [^F] [^F] - */ -protected el_action_t -/*ARGSUSED*/ -ed_next_char(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *lim = el->el_line.lastchar; - - if (el->el_line.cursor >= lim || - (el->el_line.cursor == lim - 1 && - el->el_map.type == MAP_VI && - el->el_chared.c_vcmd.action == NOP)) - return CC_ERROR; - - el->el_line.cursor += el->el_state.argument; - if (el->el_line.cursor > lim) - el->el_line.cursor = lim; - - if (el->el_map.type == MAP_VI) - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* ed_prev_word(): - * Move to the beginning of the current word - * [M-b] [b] - */ -protected el_action_t -/*ARGSUSED*/ -ed_prev_word(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor == el->el_line.buffer) - return CC_ERROR; - - el->el_line.cursor = c__prev_word(el->el_line.cursor, - el->el_line.buffer, - el->el_state.argument, - ce__isword); - - if (el->el_map.type == MAP_VI) - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* ed_prev_char(): - * Move to the left one character - * [^B] [^B] - */ -protected el_action_t -/*ARGSUSED*/ -ed_prev_char(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor > el->el_line.buffer) { - el->el_line.cursor -= el->el_state.argument; - if (el->el_line.cursor < el->el_line.buffer) - el->el_line.cursor = el->el_line.buffer; - - if (el->el_map.type == MAP_VI) - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; - } else - return CC_ERROR; -} - - -/* ed_quoted_insert(): - * Add the next character typed verbatim - * [^V] [^V] - */ -protected el_action_t -ed_quoted_insert(EditLine *el, Int c) -{ - int num; - Char tc; - - tty_quotemode(el); - num = FUN(el,getc)(el, &tc); - c = tc; - tty_noquotemode(el); - if (num == 1) - return ed_insert(el, c); - else - return ed_end_of_file(el, 0); -} - - -/* ed_digit(): - * Adds to argument or enters a digit - */ -protected el_action_t -ed_digit(EditLine *el, Int c) -{ - - if (!Isdigit(c)) - return CC_ERROR; - - if (el->el_state.doingarg) { - /* if doing an arg, add this in... */ - if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT) - el->el_state.argument = c - '0'; - else { - if (el->el_state.argument > 1000000) - return CC_ERROR; - el->el_state.argument = - (el->el_state.argument * 10) + (c - '0'); - } - return CC_ARGHACK; - } - - return ed_insert(el, c); -} - - -/* ed_argument_digit(): - * Digit that starts argument - * For ESC-n - */ -protected el_action_t -ed_argument_digit(EditLine *el, Int c) -{ - - if (!Isdigit(c)) - return CC_ERROR; - - if (el->el_state.doingarg) { - if (el->el_state.argument > 1000000) - return CC_ERROR; - el->el_state.argument = (el->el_state.argument * 10) + - (c - '0'); - } else { /* else starting an argument */ - el->el_state.argument = c - '0'; - el->el_state.doingarg = 1; - } - return CC_ARGHACK; -} - - -/* ed_unassigned(): - * Indicates unbound character - * Bound to keys that are not assigned - */ -protected el_action_t -/*ARGSUSED*/ -ed_unassigned(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_ERROR; -} - - -/** - ** TTY key handling. - **/ - -/* ed_tty_sigint(): - * Tty interrupt character - * [^C] - */ -protected el_action_t -/*ARGSUSED*/ -ed_tty_sigint(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_NORM; -} - - -/* ed_tty_dsusp(): - * Tty delayed suspend character - * [^Y] - */ -protected el_action_t -/*ARGSUSED*/ -ed_tty_dsusp(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_NORM; -} - - -/* ed_tty_flush_output(): - * Tty flush output characters - * [^O] - */ -protected el_action_t -/*ARGSUSED*/ -ed_tty_flush_output(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_NORM; -} - - -/* ed_tty_sigquit(): - * Tty quit character - * [^\] - */ -protected el_action_t -/*ARGSUSED*/ -ed_tty_sigquit(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_NORM; -} - - -/* ed_tty_sigtstp(): - * Tty suspend character - * [^Z] - */ -protected el_action_t -/*ARGSUSED*/ -ed_tty_sigtstp(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_NORM; -} - - -/* ed_tty_stop_output(): - * Tty disallow output characters - * [^S] - */ -protected el_action_t -/*ARGSUSED*/ -ed_tty_stop_output(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_NORM; -} - - -/* ed_tty_start_output(): - * Tty allow output characters - * [^Q] - */ -protected el_action_t -/*ARGSUSED*/ -ed_tty_start_output(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_NORM; -} - - -/* ed_newline(): - * Execute command - * [^J] - */ -protected el_action_t -/*ARGSUSED*/ -ed_newline(EditLine *el, Int c __attribute__((__unused__))) -{ - - re_goto_bottom(el); - *el->el_line.lastchar++ = '\n'; - *el->el_line.lastchar = '\0'; - return CC_NEWLINE; -} - - -/* ed_delete_prev_char(): - * Delete the character to the left of the cursor - * [^?] - */ -protected el_action_t -/*ARGSUSED*/ -ed_delete_prev_char(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor <= el->el_line.buffer) - return CC_ERROR; - - c_delbefore(el, el->el_state.argument); - el->el_line.cursor -= el->el_state.argument; - if (el->el_line.cursor < el->el_line.buffer) - el->el_line.cursor = el->el_line.buffer; - return CC_REFRESH; -} - - -/* ed_clear_screen(): - * Clear screen leaving current line at the top - * [^L] - */ -protected el_action_t -/*ARGSUSED*/ -ed_clear_screen(EditLine *el, Int c __attribute__((__unused__))) -{ - - terminal_clear_screen(el); /* clear the whole real screen */ - re_clear_display(el); /* reset everything */ - return CC_REFRESH; -} - - -/* ed_redisplay(): - * Redisplay everything - * ^R - */ -protected el_action_t -/*ARGSUSED*/ -ed_redisplay(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_REDISPLAY; -} - - -/* ed_start_over(): - * Erase current line and start from scratch - * [^G] - */ -protected el_action_t -/*ARGSUSED*/ -ed_start_over(EditLine *el, Int c __attribute__((__unused__))) -{ - - ch_reset(el, 0); - return CC_REFRESH; -} - - -/* ed_sequence_lead_in(): - * First character in a bound sequence - * Placeholder for external keys - */ -protected el_action_t -/*ARGSUSED*/ -ed_sequence_lead_in(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ - - return CC_NORM; -} - - -/* ed_prev_history(): - * Move to the previous history line - * [^P] [k] - */ -protected el_action_t -/*ARGSUSED*/ -ed_prev_history(EditLine *el, Int c __attribute__((__unused__))) -{ - char beep = 0; - int sv_event = el->el_history.eventno; - - el->el_chared.c_undo.len = -1; - *el->el_line.lastchar = '\0'; /* just in case */ - - if (el->el_history.eventno == 0) { /* save the current buffer - * away */ - (void) Strncpy(el->el_history.buf, el->el_line.buffer, - EL_BUFSIZ); - el->el_history.last = el->el_history.buf + - (el->el_line.lastchar - el->el_line.buffer); - } - el->el_history.eventno += el->el_state.argument; - - if (hist_get(el) == CC_ERROR) { - if (el->el_map.type == MAP_VI) { - el->el_history.eventno = sv_event; - - } - beep = 1; - /* el->el_history.eventno was fixed by first call */ - (void) hist_get(el); - } - if (beep) - return CC_REFRESH_BEEP; - return CC_REFRESH; -} - - -/* ed_next_history(): - * Move to the next history line - * [^N] [j] - */ -protected el_action_t -/*ARGSUSED*/ -ed_next_history(EditLine *el, Int c __attribute__((__unused__))) -{ - el_action_t beep = CC_REFRESH, rval; - - el->el_chared.c_undo.len = -1; - *el->el_line.lastchar = '\0'; /* just in case */ - - el->el_history.eventno -= el->el_state.argument; - - if (el->el_history.eventno < 0) { - el->el_history.eventno = 0; - beep = CC_REFRESH_BEEP; - } - rval = hist_get(el); - if (rval == CC_REFRESH) - return beep; - return rval; - -} - - -/* ed_search_prev_history(): - * Search previous in history for a line matching the current - * next search history [M-P] [K] - */ -protected el_action_t -/*ARGSUSED*/ -ed_search_prev_history(EditLine *el, Int c __attribute__((__unused__))) -{ - const Char *hp; - int h; - bool_t found = 0; - - el->el_chared.c_vcmd.action = NOP; - el->el_chared.c_undo.len = -1; - *el->el_line.lastchar = '\0'; /* just in case */ - if (el->el_history.eventno < 0) { -#ifdef DEBUG_EDIT - (void) fprintf(el->el_errfile, - "e_prev_search_hist(): eventno < 0;\n"); -#endif - el->el_history.eventno = 0; - return CC_ERROR; - } - if (el->el_history.eventno == 0) { - (void) Strncpy(el->el_history.buf, el->el_line.buffer, - EL_BUFSIZ); - el->el_history.last = el->el_history.buf + - (el->el_line.lastchar - el->el_line.buffer); - } - if (el->el_history.ref == NULL) - return CC_ERROR; - - hp = HIST_FIRST(el); - if (hp == NULL) - return CC_ERROR; - - c_setpat(el); /* Set search pattern !! */ - - for (h = 1; h <= el->el_history.eventno; h++) - hp = HIST_NEXT(el); - - while (hp != NULL) { -#ifdef SDEBUG - (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); -#endif - if ((Strncmp(hp, el->el_line.buffer, (size_t) - (el->el_line.lastchar - el->el_line.buffer)) || - hp[el->el_line.lastchar - el->el_line.buffer]) && - c_hmatch(el, hp)) { - found++; - break; - } - h++; - hp = HIST_NEXT(el); - } - - if (!found) { -#ifdef SDEBUG - (void) fprintf(el->el_errfile, "not found\n"); -#endif - return CC_ERROR; - } - el->el_history.eventno = h; - - return hist_get(el); -} - - -/* ed_search_next_history(): - * Search next in history for a line matching the current - * [M-N] [J] - */ -protected el_action_t -/*ARGSUSED*/ -ed_search_next_history(EditLine *el, Int c __attribute__((__unused__))) -{ - const Char *hp; - int h; - bool_t found = 0; - - el->el_chared.c_vcmd.action = NOP; - el->el_chared.c_undo.len = -1; - *el->el_line.lastchar = '\0'; /* just in case */ - - if (el->el_history.eventno == 0) - return CC_ERROR; - - if (el->el_history.ref == NULL) - return CC_ERROR; - - hp = HIST_FIRST(el); - if (hp == NULL) - return CC_ERROR; - - c_setpat(el); /* Set search pattern !! */ - - for (h = 1; h < el->el_history.eventno && hp; h++) { -#ifdef SDEBUG - (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); -#endif - if ((Strncmp(hp, el->el_line.buffer, (size_t) - (el->el_line.lastchar - el->el_line.buffer)) || - hp[el->el_line.lastchar - el->el_line.buffer]) && - c_hmatch(el, hp)) - found = h; - hp = HIST_NEXT(el); - } - - if (!found) { /* is it the current history number? */ - if (!c_hmatch(el, el->el_history.buf)) { -#ifdef SDEBUG - (void) fprintf(el->el_errfile, "not found\n"); -#endif - return CC_ERROR; - } - } - el->el_history.eventno = found; - - return hist_get(el); -} - - -/* ed_prev_line(): - * Move up one line - * Could be [k] [^p] - */ -protected el_action_t -/*ARGSUSED*/ -ed_prev_line(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *ptr; - int nchars = c_hpos(el); - - /* - * Move to the line requested - */ - if (*(ptr = el->el_line.cursor) == '\n') - ptr--; - - for (; ptr >= el->el_line.buffer; ptr--) - if (*ptr == '\n' && --el->el_state.argument <= 0) - break; - - if (el->el_state.argument > 0) - return CC_ERROR; - - /* - * Move to the beginning of the line - */ - for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--) - continue; - - /* - * Move to the character requested - */ - for (ptr++; - nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; - ptr++) - continue; - - el->el_line.cursor = ptr; - return CC_CURSOR; -} - - -/* ed_next_line(): - * Move down one line - * Could be [j] [^n] - */ -protected el_action_t -/*ARGSUSED*/ -ed_next_line(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *ptr; - int nchars = c_hpos(el); - - /* - * Move to the line requested - */ - for (ptr = el->el_line.cursor; ptr < el->el_line.lastchar; ptr++) - if (*ptr == '\n' && --el->el_state.argument <= 0) - break; - - if (el->el_state.argument > 0) - return CC_ERROR; - - /* - * Move to the character requested - */ - for (ptr++; - nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; - ptr++) - continue; - - el->el_line.cursor = ptr; - return CC_CURSOR; -} - - -/* ed_command(): - * Editline extended command - * [M-X] [:] - */ -protected el_action_t -/*ARGSUSED*/ -ed_command(EditLine *el, Int c __attribute__((__unused__))) -{ - Char tmpbuf[EL_BUFSIZ]; - int tmplen; - - tmplen = c_gets(el, tmpbuf, STR("\n: ")); - terminal__putc(el, '\n'); - - if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1) - terminal_beep(el); - - el->el_map.current = el->el_map.key; - re_clear_display(el); - return CC_REFRESH; -} diff --git a/cmd-line-utils/libedit/config.h b/cmd-line-utils/libedit/config.h deleted file mode 100644 index c06d5e28a0a..00000000000 --- a/cmd-line-utils/libedit/config.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "my_config.h" -#include "sys.h" -#ifndef NARROW_WRAPPER -#define WIDECHAR -#endif diff --git a/cmd-line-utils/libedit/el.c b/cmd-line-utils/libedit/el.c deleted file mode 100644 index c7f4f81ec93..00000000000 --- a/cmd-line-utils/libedit/el.c +++ /dev/null @@ -1,636 +0,0 @@ -/* $NetBSD: el.c,v 1.68 2011/07/29 15:16:33 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * el.c: EditLine interface functions - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "el.h" - -/* el_init(): - * Initialize editline and set default parameters. - */ -public EditLine * -el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr) -{ - EditLine *el = el_malloc(sizeof(*el)); - - if (el == NULL) - return NULL; - - memset(el, 0, sizeof(EditLine)); - - el->el_infile = fin; - el->el_outfile = fout; - el->el_errfile = ferr; - - el->el_infd = fileno(fin); - el->el_outfd = fileno(fout); - el->el_errfd = fileno(ferr); - - el->el_prog = Strdup(ct_decode_string(prog, &el->el_scratch)); - if (el->el_prog == NULL) { - el_free(el); - return NULL; - } - - /* - * Initialize all the modules. Order is important!!! - */ - el->el_flags = 0; -#ifdef WIDECHAR - setlocale(LC_CTYPE, NULL); - if (MB_CUR_MAX > 1) - el->el_flags |= CHARSET_IS_MULTIBYTE; -#endif - - if (terminal_init(el) == -1) { - el_free(el->el_prog); - el_free(el); - return NULL; - } - (void) keymacro_init(el); - (void) map_init(el); - if (tty_init(el) == -1) - el->el_flags |= NO_TTY; - (void) ch_init(el); - (void) search_init(el); - (void) hist_init(el); - (void) prompt_init(el); - (void) sig_init(el); - (void) read_init(el); - - return el; -} - - -/* el_end(): - * Clean up. - */ -public void -el_end(EditLine *el) -{ - - if (el == NULL) - return; - - el_reset(el); - - terminal_end(el); - keymacro_end(el); - map_end(el); - tty_end(el); - ch_end(el); - search_end(el); - hist_end(el); - prompt_end(el); - sig_end(el); - - el_free(el->el_prog); -#ifdef WIDECHAR - el_free(el->el_scratch.cbuff); - el_free(el->el_scratch.wbuff); - el_free(el->el_lgcyconv.cbuff); - el_free(el->el_lgcyconv.wbuff); -#endif - el_free(el); -} - - -/* el_reset(): - * Reset the tty and the parser - */ -public void -el_reset(EditLine *el) -{ - - tty_cookedmode(el); - ch_reset(el, 0); /* XXX: Do we want that? */ -} - - -/* el_set(): - * set the editline parameters - */ -public int -FUN(el,set)(EditLine *el, int op, ...) -{ - va_list ap; - int rv = 0; - - if (el == NULL) - return -1; - va_start(ap, op); - - switch (op) { - case EL_PROMPT: - case EL_RPROMPT: { - el_pfunc_t p = va_arg(ap, el_pfunc_t); - - rv = prompt_set(el, p, 0, op, 1); - break; - } - - case EL_RESIZE: { - el_zfunc_t p = va_arg(ap, el_zfunc_t); - void *arg = va_arg(ap, void *); - rv = ch_resizefun(el, p, arg); - break; - } - - case EL_PROMPT_ESC: - case EL_RPROMPT_ESC: { - el_pfunc_t p = va_arg(ap, el_pfunc_t); - int c = va_arg(ap, int); - - rv = prompt_set(el, p, c, op, 1); - break; - } - - case EL_TERMINAL: - rv = terminal_set(el, va_arg(ap, char *)); - break; - - case EL_EDITOR: - rv = map_set_editor(el, va_arg(ap, Char *)); - break; - - case EL_SIGNAL: - if (va_arg(ap, int)) - el->el_flags |= HANDLE_SIGNALS; - else - el->el_flags &= ~HANDLE_SIGNALS; - break; - - case EL_BIND: - case EL_TELLTC: - case EL_SETTC: - case EL_ECHOTC: - case EL_SETTY: - { - const Char *argv[20]; - int i; - - for (i = 1; i < 20; i++) - if ((argv[i] = va_arg(ap, Char *)) == NULL) - break; - - switch (op) { - case EL_BIND: - argv[0] = STR("bind"); - rv = map_bind(el, i, argv); - break; - - case EL_TELLTC: - argv[0] = STR("telltc"); - rv = terminal_telltc(el, i, argv); - break; - - case EL_SETTC: - argv[0] = STR("settc"); - rv = terminal_settc(el, i, argv); - break; - - case EL_ECHOTC: - argv[0] = STR("echotc"); - rv = terminal_echotc(el, i, argv); - break; - - case EL_SETTY: - argv[0] = STR("setty"); - rv = tty_stty(el, i, argv); - break; - - default: - rv = -1; - EL_ABORT((el->el_errfile, "Bad op %d\n", op)); - break; - } - break; - } - - case EL_ADDFN: - { - Char *name = va_arg(ap, Char *); - Char *help = va_arg(ap, Char *); - el_func_t func = va_arg(ap, el_func_t); - - rv = map_addfunc(el, name, help, func); - break; - } - - case EL_HIST: - { - hist_fun_t func = va_arg(ap, hist_fun_t); - void *ptr = va_arg(ap, void *); - - rv = hist_set(el, func, ptr); - if (!(el->el_flags & CHARSET_IS_MULTIBYTE)) - el->el_flags &= ~NARROW_HISTORY; - break; - } - - case EL_EDITMODE: - if (va_arg(ap, int)) - el->el_flags &= ~EDIT_DISABLED; - else - el->el_flags |= EDIT_DISABLED; - rv = 0; - break; - - case EL_GETCFN: - { - el_rfunc_t rc = va_arg(ap, el_rfunc_t); - rv = el_read_setfn(el, rc); - el->el_flags &= ~NARROW_READ; - break; - } - - case EL_CLIENTDATA: - el->el_data = va_arg(ap, void *); - break; - - case EL_UNBUFFERED: - rv = va_arg(ap, int); - if (rv && !(el->el_flags & UNBUFFERED)) { - el->el_flags |= UNBUFFERED; - read_prepare(el); - } else if (!rv && (el->el_flags & UNBUFFERED)) { - el->el_flags &= ~UNBUFFERED; - read_finish(el); - } - rv = 0; - break; - - case EL_PREP_TERM: - rv = va_arg(ap, int); - if (rv) - (void) tty_rawmode(el); - else - (void) tty_cookedmode(el); - rv = 0; - break; - - case EL_SETFP: - { - FILE *fp; - int what; - - what = va_arg(ap, int); - fp = va_arg(ap, FILE *); - - rv = 0; - switch (what) { - case 0: - el->el_infile = fp; - el->el_infd = fileno(fp); - break; - case 1: - el->el_outfile = fp; - el->el_outfd = fileno(fp); - break; - case 2: - el->el_errfile = fp; - el->el_errfd = fileno(fp); - break; - default: - rv = -1; - break; - } - break; - } - - case EL_REFRESH: - re_clear_display(el); - re_refresh(el); - terminal__flush(el); - break; - - default: - rv = -1; - break; - } - - va_end(ap); - return rv; -} - - -/* el_get(): - * retrieve the editline parameters - */ -public int -FUN(el,get)(EditLine *el, int op, ...) -{ - va_list ap; - int rv; - - if (el == NULL) - return -1; - - va_start(ap, op); - - switch (op) { - case EL_PROMPT: - case EL_RPROMPT: { - el_pfunc_t *p = va_arg(ap, el_pfunc_t *); - rv = prompt_get(el, p, 0, op); - break; - } - case EL_PROMPT_ESC: - case EL_RPROMPT_ESC: { - el_pfunc_t *p = va_arg(ap, el_pfunc_t *); - Char *c = va_arg(ap, Char *); - - rv = prompt_get(el, p, c, op); - break; - } - - case EL_EDITOR: - rv = map_get_editor(el, va_arg(ap, const Char **)); - break; - - case EL_SIGNAL: - *va_arg(ap, int *) = (el->el_flags & HANDLE_SIGNALS); - rv = 0; - break; - - case EL_EDITMODE: - *va_arg(ap, int *) = !(el->el_flags & EDIT_DISABLED); - rv = 0; - break; - - case EL_TERMINAL: - terminal_get(el, va_arg(ap, const char **)); - rv = 0; - break; - - case EL_GETTC: - { - static char name[] = "gettc"; - char *argv[20]; - int i; - - for (i = 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++) - if ((argv[i] = va_arg(ap, char *)) == NULL) - break; - - switch (op) { - case EL_GETTC: - argv[0] = name; - rv = terminal_gettc(el, i, argv); - break; - - default: - rv = -1; - EL_ABORT((el->el_errfile, "Bad op %d\n", op)); - break; - } - break; - } - - case EL_GETCFN: - *va_arg(ap, el_rfunc_t *) = el_read_getfn(el); - rv = 0; - break; - - case EL_CLIENTDATA: - *va_arg(ap, void **) = el->el_data; - rv = 0; - break; - - case EL_UNBUFFERED: - *va_arg(ap, int *) = (!(el->el_flags & UNBUFFERED)); - rv = 0; - break; - - case EL_GETFP: - { - int what; - FILE **fpp; - - what = va_arg(ap, int); - fpp = va_arg(ap, FILE **); - rv = 0; - switch (what) { - case 0: - *fpp = el->el_infile; - break; - case 1: - *fpp = el->el_outfile; - break; - case 2: - *fpp = el->el_errfile; - break; - default: - rv = -1; - break; - } - break; - } - default: - rv = -1; - break; - } - va_end(ap); - - return rv; -} - - -/* el_line(): - * Return editing info - */ -public const TYPE(LineInfo) * -FUN(el,line)(EditLine *el) -{ - - return (const TYPE(LineInfo) *)(void *)&el->el_line; -} - - -/* el_source(): - * Source a file - */ -public int -el_source(EditLine *el, const char *fname) -{ - FILE *fp; - size_t len; - char *ptr; - char *path = NULL; - const Char *dptr; - int error = 0; - - fp = NULL; - if (fname == NULL) { -/* XXXMYSQL: Bug#49967 */ -#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) && \ - defined(HAVE_GETGID) && defined(HAVE_GETEGID) -#define HAVE_IDENTITY_FUNCS 1 -#endif - -#if (defined(HAVE_ISSETUGID) || defined(HAVE_IDENTITY_FUNCS)) - static const char elpath[] = "/.editrc"; - size_t plen = sizeof(elpath); -/* XXXMYSQL: Portability fix (for which platforms?) */ -#ifdef HAVE_ISSETUGID - if (issetugid()) - return -1; -#elif defined(HAVE_IDENTITY_FUNCS) - if (getuid() != geteuid() || getgid() != getegid()) - return (-1); -#endif - if ((ptr = getenv("HOME")) == NULL) - return -1; - plen += strlen(ptr); - if ((path = el_malloc(plen * sizeof(*path))) == NULL) - return -1; - (void)snprintf(path, plen, "%s%s", ptr, elpath); - fname = path; -#else - /* - * If issetugid() or the above mentioned get[e][u|g]id() - * functions are 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"); - if (fp == NULL) { - el_free(path); - return -1; - } - - while ((ptr = fgetln(fp, &len)) != NULL) { - if (*ptr == '\n') - continue; /* Empty line. */ - dptr = ct_decode_string(ptr, &el->el_scratch); - if (!dptr) - continue; - if (len > 0 && dptr[len - 1] == '\n') - --len; - - /* loop until first non-space char or EOL */ - while (*dptr != '\0' && Isspace(*dptr)) - dptr++; - if (*dptr == '#') - continue; /* ignore, this is a comment line */ - if ((error = parse_line(el, dptr)) == -1) - break; - } - - el_free(path); - (void) fclose(fp); - return error; -} - - -/* el_resize(): - * Called from program when terminal is resized - */ -public void -el_resize(EditLine *el) -{ - int lins, cols; - sigset_t oset, nset; - - (void) sigemptyset(&nset); - (void) sigaddset(&nset, SIGWINCH); - (void) sigprocmask(SIG_BLOCK, &nset, &oset); - - /* get the correct window size */ - if (terminal_get_size(el, &lins, &cols)) - terminal_change_size(el, lins, cols); - - (void) sigprocmask(SIG_SETMASK, &oset, NULL); -} - - -/* el_beep(): - * Called from the program to beep - */ -public void -el_beep(EditLine *el) -{ - - terminal_beep(el); -} - - -/* el_editmode() - * Set the state of EDIT_DISABLED from the `edit' command. - */ -protected int -/*ARGSUSED*/ -el_editmode(EditLine *el, int argc, const Char **argv) -{ - const Char *how; - - if (argv == NULL || argc != 2 || argv[1] == NULL) - return -1; - - how = argv[1]; - if (Strcmp(how, STR("on")) == 0) { - el->el_flags &= ~EDIT_DISABLED; - tty_rawmode(el); - } else if (Strcmp(how, STR("off")) == 0) { - tty_cookedmode(el); - el->el_flags |= EDIT_DISABLED; - } - else { - (void) fprintf(el->el_errfile, "edit: Bad value `" FSTR "'.\n", - how); - return -1; - } - return 0; -} diff --git a/cmd-line-utils/libedit/el.h b/cmd-line-utils/libedit/el.h deleted file mode 100644 index 403a44aa806..00000000000 --- a/cmd-line-utils/libedit/el.h +++ /dev/null @@ -1,166 +0,0 @@ -/* $NetBSD: el.h,v 1.25 2011/07/29 23:44:44 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)el.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.h: Internal structures. - */ -#ifndef _h_el -#define _h_el -/* - * Local defaults - */ -#define KSHVI -#define VIDEFAULT -#define ANCHOR - -#include "histedit.h" -#include "chartype.h" -#include -#include - -#define EL_BUFSIZ ((size_t)4096) /* Maximum line size */ - -#define HANDLE_SIGNALS 0x01 -#define NO_TTY 0x02 -#define EDIT_DISABLED 0x04 -#define UNBUFFERED 0x08 -#define CHARSET_IS_MULTIBYTE 0x10 -#define IGNORE_EXTCHARS 0x20 /* Ignore characters read > 0xff */ -#define NARROW_HISTORY 0x40 -#define NARROW_READ 0x80 - -typedef int bool_t; /* True or not */ - -typedef unsigned char el_action_t; /* Index to command array */ - -typedef struct coord_t { /* Position on the screen */ - int h; - int v; -} coord_t; - -typedef struct el_line_t { - Char *buffer; /* Input line */ - Char *cursor; /* Cursor position */ - Char *lastchar; /* Last character */ - const Char *limit; /* Max position */ -} el_line_t; - -/* - * Editor state - */ -typedef struct el_state_t { - int inputmode; /* What mode are we in? */ - int doingarg; /* Are we getting an argument? */ - int argument; /* Numeric argument */ - int metanext; /* Is the next char a meta char */ - el_action_t lastcmd; /* Previous command */ - el_action_t thiscmd; /* this command */ - Char thisch; /* char that generated it */ -} el_state_t; - -/* - * Until we come up with something better... - */ -#define el_malloc(a) malloc(a) -#define el_realloc(a,b) realloc(a, b) -#define el_free(a) free(a) - -#include "tty.h" -#include "prompt.h" -#include "keymacro.h" -#include "el_terminal.h" -#include "refresh.h" -#include "chared.h" -#include "common.h" -#include "search.h" -#include "hist.h" -#include "map.h" -#include "parse.h" -#include "sig.h" -#include "help.h" -#include "read.h" - -struct editline { - Char *el_prog; /* the program name */ - FILE *el_infile; /* Stdio stuff */ - FILE *el_outfile; /* Stdio stuff */ - FILE *el_errfile; /* Stdio stuff */ - int el_infd; /* Input file descriptor */ - int el_outfd; /* Output file descriptor */ - int el_errfd; /* Error file descriptor */ - int el_flags; /* Various flags. */ - int el_errno; /* Local copy of errno */ - coord_t el_cursor; /* Cursor location */ - Char **el_display; /* Real screen image = what is there */ - Char **el_vdisplay; /* Virtual screen image = what we see */ - void *el_data; /* Client data */ - el_line_t el_line; /* The current line information */ - el_state_t el_state; /* Current editor state */ - el_terminal_t el_terminal; /* Terminal dependent stuff */ - el_tty_t el_tty; /* Tty dependent stuff */ - el_refresh_t el_refresh; /* Refresh stuff */ - el_prompt_t el_prompt; /* Prompt stuff */ - el_prompt_t el_rprompt; /* Prompt stuff */ - el_chared_t el_chared; /* Characted editor stuff */ - el_map_t el_map; /* Key mapping stuff */ - el_keymacro_t el_keymacro; /* Key binding stuff */ - el_history_t el_history; /* History stuff */ - el_search_t el_search; /* Search stuff */ - el_signal_t el_signal; /* Signal handling stuff */ - el_read_t el_read; /* Character reading stuff */ -#ifdef WIDECHAR - ct_buffer_t el_scratch; /* Scratch conversion buffer */ - ct_buffer_t el_lgcyconv; /* Buffer for legacy wrappers */ - LineInfo el_lgcylinfo; /* Legacy LineInfo buffer */ -#endif -}; - -protected int el_editmode(EditLine *, int, const Char **); - -/* XXXMYSQL: Bug#23097 mysql can't insert korean on mysql prompt. */ -#define el_isprint(x) ((unsigned char) (x) < 0x80 ? isprint(x) : 1) - -#ifdef DEBUG -#define EL_ABORT(a) do { \ - fprintf(el->el_errfile, "%s, %d: ", \ - __FILE__, __LINE__); \ - fprintf a; \ - abort(); \ - } while( /*CONSTCOND*/0); -#else -#define EL_ABORT(a) abort() -#endif -#endif /* _h_el */ diff --git a/cmd-line-utils/libedit/el_terminal.h b/cmd-line-utils/libedit/el_terminal.h deleted file mode 100644 index 807c651783e..00000000000 --- a/cmd-line-utils/libedit/el_terminal.h +++ /dev/null @@ -1,125 +0,0 @@ -/* $NetBSD: terminal.h,v 1.3 2011/07/29 23:44:45 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)term.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.term.h: Termcap header - */ -#ifndef _h_el_terminal -#define _h_el_terminal - -#include "histedit.h" - -typedef struct { /* Symbolic function key bindings */ - const Char *name; /* name of the key */ - int key; /* Index in termcap table */ - keymacro_value_t fun; /* Function bound to it */ - int type; /* Type of function */ -} funckey_t; - -typedef struct { - const char *t_name; /* the terminal name */ - coord_t t_size; /* # lines and cols */ - int t_flags; -#define TERM_CAN_INSERT 0x001 /* Has insert cap */ -#define TERM_CAN_DELETE 0x002 /* Has delete cap */ -#define TERM_CAN_CEOL 0x004 /* Has CEOL cap */ -#define TERM_CAN_TAB 0x008 /* Can use tabs */ -#define TERM_CAN_ME 0x010 /* Can turn all attrs. */ -#define TERM_CAN_UP 0x020 /* Can move up */ -#define TERM_HAS_META 0x040 /* Has a meta key */ -#define TERM_HAS_AUTO_MARGINS 0x080 /* Has auto margins */ -#define TERM_HAS_MAGIC_MARGINS 0x100 /* Has magic margins */ - char *t_buf; /* Termcap buffer */ - size_t t_loc; /* location used */ - char **t_str; /* termcap strings */ - int *t_val; /* termcap values */ - char *t_cap; /* Termcap buffer */ - funckey_t *t_fkey; /* Array of keys */ -} el_terminal_t; - -/* - * fKey indexes - */ -#define A_K_DN 0 -#define A_K_UP 1 -#define A_K_LT 2 -#define A_K_RT 3 -#define A_K_HO 4 -#define A_K_EN 5 -#define A_K_NKEYS 6 - -protected void terminal_move_to_line(EditLine *, int); -protected void terminal_move_to_char(EditLine *, int); -protected void terminal_clear_EOL(EditLine *, int); -protected void terminal_overwrite(EditLine *, const Char *, size_t); -protected void terminal_insertwrite(EditLine *, Char *, int); -protected void terminal_deletechars(EditLine *, int); -protected void terminal_clear_screen(EditLine *); -protected void terminal_beep(EditLine *); -protected int terminal_change_size(EditLine *, int, int); -protected int terminal_get_size(EditLine *, int *, int *); -protected int terminal_init(EditLine *); -protected void terminal_bind_arrow(EditLine *); -protected void terminal_print_arrow(EditLine *, const Char *); -protected int terminal_clear_arrow(EditLine *, const Char *); -protected int terminal_set_arrow(EditLine *, const Char *, keymacro_value_t *, int); -protected void terminal_end(EditLine *); -protected void terminal_get(EditLine *, const char **); -protected int terminal_set(EditLine *, const char *); -protected int terminal_settc(EditLine *, int, const Char **); -protected int terminal_gettc(EditLine *, int, char **); -protected int terminal_telltc(EditLine *, int, const Char **); -protected int terminal_echotc(EditLine *, int, const Char **); -protected void terminal_writec(EditLine *, Int); -protected int terminal__putc(EditLine *, Int); -protected void terminal__flush(EditLine *); - -/* - * Easy access macros - */ -#define EL_FLAGS (el)->el_terminal.t_flags - -#define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT) -#define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE) -#define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL) -#define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB) -#define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME) -#define EL_CAN_UP (EL_FLAGS & TERM_CAN_UP) -#define EL_HAS_META (EL_FLAGS & TERM_HAS_META) -#define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS) -#define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS) - -#endif /* _h_el_terminal */ diff --git a/cmd-line-utils/libedit/eln.c b/cmd-line-utils/libedit/eln.c deleted file mode 100644 index f996367115a..00000000000 --- a/cmd-line-utils/libedit/eln.c +++ /dev/null @@ -1,364 +0,0 @@ -/* $NetBSD: eln.c,v 1.13 2011/08/16 16:25:15 christos Exp $ */ - -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#endif /* not lint && not SCCSID */ - -#include "histedit.h" -#include "el.h" -#include "read.h" -#include -#include -#include - -public int -el_getc(EditLine *el, char *cp) -{ - int num_read; - wchar_t wc = 0; - - num_read = el_wgetc (el, &wc); - - if (num_read > 0) - *cp = (char)wc; - return num_read; -} - - -public void -el_push(EditLine *el, const char *str) -{ - /* Using multibyte->wide string decoding works fine under single-byte - * character sets too, and Does The Right Thing. */ - el_wpush(el, ct_decode_string(str, &el->el_lgcyconv)); -} - - -public const char * -el_gets(EditLine *el, int *nread) -{ - const wchar_t *tmp; - - tmp = el_wgets(el, nread); - return ct_encode_string(tmp, &el->el_lgcyconv); -} - - -public int -el_parse(EditLine *el, int argc, const char *argv[]) -{ - int ret; - const wchar_t **wargv; - - wargv = (const wchar_t **) - ct_decode_argv(argc, argv, &el->el_lgcyconv); - if (!wargv) - return -1; - ret = el_wparse(el, argc, wargv); - ct_free_argv(wargv); - - return ret; -} - - -public int -el_set(EditLine *el, int op, ...) -{ - va_list ap; - int ret; - - if (!el) - return -1; - va_start(ap, op); - - switch (op) { - case EL_PROMPT: /* el_pfunc_t */ - case EL_RPROMPT: { - el_pfunc_t p = va_arg(ap, el_pfunc_t); - ret = prompt_set(el, p, 0, op, 0); - break; - } - - case EL_RESIZE: { - el_zfunc_t p = va_arg(ap, el_zfunc_t); - void *arg = va_arg(ap, void *); - ret = ch_resizefun(el, p, arg); - break; - } - - case EL_TERMINAL: /* const char * */ - ret = el_wset(el, op, va_arg(ap, char *)); - break; - - case EL_EDITOR: /* const wchar_t * */ - ret = el_wset(el, op, ct_decode_string(va_arg(ap, char *), - &el->el_lgcyconv)); - break; - - case EL_SIGNAL: /* int */ - case EL_EDITMODE: - case EL_UNBUFFERED: - case EL_PREP_TERM: - ret = el_wset(el, op, va_arg(ap, int)); - break; - - case EL_BIND: /* const char * list -> const wchar_t * list */ - case EL_TELLTC: - case EL_SETTC: - case EL_ECHOTC: - case EL_SETTY: { - const char *argv[20]; - int i; - const wchar_t **wargv; - for (i = 1; i < (int)__arraycount(argv); ++i) - if ((argv[i] = va_arg(ap, char *)) == NULL) - break; - argv[0] = NULL; - wargv = (const wchar_t **) - ct_decode_argv(i, argv, &el->el_lgcyconv); - if (!wargv) { - ret = -1; - goto out; - } - /* - * AFAIK we can't portably pass through our new wargv to - * el_wset(), so we have to reimplement the body of - * el_wset() for these ops. - */ - switch (op) { - case EL_BIND: - wargv[0] = STR("bind"); - ret = map_bind(el, i, wargv); - break; - case EL_TELLTC: - wargv[0] = STR("telltc"); - ret = terminal_telltc(el, i, wargv); - break; - case EL_SETTC: - wargv[0] = STR("settc"); - ret = terminal_settc(el, i, wargv); - break; - case EL_ECHOTC: - wargv[0] = STR("echotc"); - ret = terminal_echotc(el, i, wargv); - break; - case EL_SETTY: - wargv[0] = STR("setty"); - ret = tty_stty(el, i, wargv); - break; - default: - ret = -1; - } - ct_free_argv(wargv); - break; - } - - /* XXX: do we need to change el_func_t too? */ - case EL_ADDFN: { /* const char *, const char *, el_func_t */ - const char *args[2]; - el_func_t func; - wchar_t **wargv; - - args[0] = va_arg(ap, const char *); - args[1] = va_arg(ap, const char *); - func = va_arg(ap, el_func_t); - - wargv = ct_decode_argv(2, args, &el->el_lgcyconv); - if (!wargv) { - ret = -1; - goto out; - } - /* XXX: The two strdups leak. */ - ret = map_addfunc(el, Strdup(wargv[0]), Strdup(wargv[1]), - func); - ct_free_argv(wargv); - break; - } - case EL_HIST: { /* hist_fun_t, const char * */ - hist_fun_t fun = va_arg(ap, hist_fun_t); - void *ptr = va_arg(ap, void *); - ret = hist_set(el, fun, ptr); - el->el_flags |= NARROW_HISTORY; - break; - } - /* XXX: do we need to change el_rfunc_t? */ - case EL_GETCFN: /* el_rfunc_t */ - ret = el_wset(el, op, va_arg(ap, el_rfunc_t)); - el->el_flags |= NARROW_READ; - break; - case EL_CLIENTDATA: /* void * */ - ret = el_wset(el, op, va_arg(ap, void *)); - break; - case EL_SETFP: { /* int, FILE * */ - int what = va_arg(ap, int); - FILE *fp = va_arg(ap, FILE *); - ret = el_wset(el, op, what, fp); - break; - } - case EL_PROMPT_ESC: /* el_pfunc_t, char */ - case EL_RPROMPT_ESC: { - el_pfunc_t p = va_arg(ap, el_pfunc_t); - char c = (char)va_arg(ap, int); - ret = prompt_set(el, p, c, op, 0); - break; - } - default: - ret = -1; - break; - } - -out: - va_end(ap); - return ret; -} - - -public int -el_get(EditLine *el, int op, ...) -{ - va_list ap; - int ret; - - if (!el) - return -1; - - va_start(ap, op); - - switch (op) { - case EL_PROMPT: /* el_pfunc_t * */ - case EL_RPROMPT: { - el_pfunc_t *p = va_arg(ap, el_pfunc_t *); - ret = prompt_get(el, p, 0, op); - break; - } - - case EL_PROMPT_ESC: /* el_pfunc_t *, char **/ - case EL_RPROMPT_ESC: { - el_pfunc_t *p = va_arg(ap, el_pfunc_t *); - char *c = va_arg(ap, char *); - wchar_t wc = 0; - ret = prompt_get(el, p, &wc, op); - *c = (char)wc; - break; - } - - case EL_EDITOR: { - const char **p = va_arg(ap, const char **); - const wchar_t *pw; - ret = el_wget(el, op, &pw); - *p = ct_encode_string(pw, &el->el_lgcyconv); - if (!el->el_lgcyconv.csize) - ret = -1; - break; - } - - case EL_TERMINAL: /* const char ** */ - ret = el_wget(el, op, va_arg(ap, const char **)); - break; - - case EL_SIGNAL: /* int * */ - case EL_EDITMODE: - case EL_UNBUFFERED: - case EL_PREP_TERM: - ret = el_wget(el, op, va_arg(ap, int *)); - break; - - case EL_GETTC: { - char *argv[20]; - static char gettc[] = "gettc"; - int i; - for (i = 1; i < (int)__arraycount(argv); ++i) - if ((argv[i] = va_arg(ap, char *)) == NULL) - break; - argv[0] = gettc; - ret = terminal_gettc(el, i, argv); - break; - } - - /* XXX: do we need to change el_rfunc_t? */ - case EL_GETCFN: /* el_rfunc_t */ - ret = el_wget(el, op, va_arg(ap, el_rfunc_t *)); - break; - - case EL_CLIENTDATA: /* void ** */ - ret = el_wget(el, op, va_arg(ap, void **)); - break; - - case EL_GETFP: { /* int, FILE ** */ - int what = va_arg(ap, int); - FILE **fpp = va_arg(ap, FILE **); - ret = el_wget(el, op, what, fpp); - break; - } - - default: - ret = -1; - break; - } - - va_end(ap); - return ret; -} - - -const LineInfo * -el_line(EditLine *el) -{ - const LineInfoW *winfo = el_wline(el); - LineInfo *info = &el->el_lgcylinfo; - size_t offset; - const Char *p; - - info->buffer = ct_encode_string(winfo->buffer, &el->el_lgcyconv); - - offset = 0; - for (p = winfo->buffer; p < winfo->cursor; p++) - offset += ct_enc_width(*p); - info->cursor = info->buffer + offset; - - offset = 0; - for (p = winfo->buffer; p < winfo->lastchar; p++) - offset += ct_enc_width(*p); - info->lastchar = info->buffer + offset; - - return info; -} - - -int -el_insertstr(EditLine *el, const char *str) -{ - return el_winsertstr(el, ct_decode_string(str, &el->el_lgcyconv)); -} diff --git a/cmd-line-utils/libedit/emacs.c b/cmd-line-utils/libedit/emacs.c deleted file mode 100644 index 554d3970485..00000000000 --- a/cmd-line-utils/libedit/emacs.c +++ /dev/null @@ -1,507 +0,0 @@ -/* $NetBSD: emacs.c,v 1.25 2011/07/29 15:16:33 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * emacs.c: Emacs functions - */ -#include "el.h" - -/* em_delete_or_list(): - * Delete character under cursor or list completions if at end of line - * [^D] - */ -protected el_action_t -/*ARGSUSED*/ -em_delete_or_list(EditLine *el, Int c) -{ - - if (el->el_line.cursor == el->el_line.lastchar) { - /* if I'm at the end */ - if (el->el_line.cursor == el->el_line.buffer) { - /* and the beginning */ - terminal_writec(el, c); /* then do an EOF */ - return CC_EOF; - } else { - /* - * Here we could list completions, but it is an - * error right now - */ - terminal_beep(el); - return CC_ERROR; - } - } else { - if (el->el_state.doingarg) - c_delafter(el, el->el_state.argument); - else - c_delafter1(el); - if (el->el_line.cursor > el->el_line.lastchar) - el->el_line.cursor = el->el_line.lastchar; - /* bounds check */ - return CC_REFRESH; - } -} - - -/* em_delete_next_word(): - * Cut from cursor to end of current word - * [M-d] - */ -protected el_action_t -/*ARGSUSED*/ -em_delete_next_word(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *cp, *p, *kp; - - if (el->el_line.cursor == el->el_line.lastchar) - return CC_ERROR; - - cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, - el->el_state.argument, ce__isword); - - for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++) - /* save the text */ - *kp++ = *p; - el->el_chared.c_kill.last = kp; - - c_delafter(el, (int)(cp - el->el_line.cursor)); /* delete after dot */ - if (el->el_line.cursor > el->el_line.lastchar) - el->el_line.cursor = el->el_line.lastchar; - /* bounds check */ - return CC_REFRESH; -} - - -/* em_yank(): - * Paste cut buffer at cursor position - * [^Y] - */ -protected el_action_t -/*ARGSUSED*/ -em_yank(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *kp, *cp; - - if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf) - return CC_NORM; - - if (el->el_line.lastchar + - (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= - el->el_line.limit) - return CC_ERROR; - - el->el_chared.c_kill.mark = el->el_line.cursor; - cp = el->el_line.cursor; - - /* open the space, */ - c_insert(el, - (int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf)); - /* copy the chars */ - for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) - *cp++ = *kp; - - /* if an arg, cursor at beginning else cursor at end */ - if (el->el_state.argument == 1) - el->el_line.cursor = cp; - - return CC_REFRESH; -} - - -/* em_kill_line(): - * Cut the entire line and save in cut buffer - * [^U] - */ -protected el_action_t -/*ARGSUSED*/ -em_kill_line(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *kp, *cp; - - cp = el->el_line.buffer; - kp = el->el_chared.c_kill.buf; - while (cp < el->el_line.lastchar) - *kp++ = *cp++; /* copy it */ - el->el_chared.c_kill.last = kp; - /* zap! -- delete all of it */ - el->el_line.lastchar = el->el_line.buffer; - el->el_line.cursor = el->el_line.buffer; - return CC_REFRESH; -} - - -/* em_kill_region(): - * Cut area between mark and cursor and save in cut buffer - * [^W] - */ -protected el_action_t -/*ARGSUSED*/ -em_kill_region(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *kp, *cp; - - if (!el->el_chared.c_kill.mark) - return CC_ERROR; - - if (el->el_chared.c_kill.mark > el->el_line.cursor) { - cp = el->el_line.cursor; - kp = el->el_chared.c_kill.buf; - while (cp < el->el_chared.c_kill.mark) - *kp++ = *cp++; /* copy it */ - el->el_chared.c_kill.last = kp; - c_delafter(el, (int)(cp - el->el_line.cursor)); - } else { /* mark is before cursor */ - cp = el->el_chared.c_kill.mark; - kp = el->el_chared.c_kill.buf; - while (cp < el->el_line.cursor) - *kp++ = *cp++; /* copy it */ - el->el_chared.c_kill.last = kp; - c_delbefore(el, (int)(cp - el->el_chared.c_kill.mark)); - el->el_line.cursor = el->el_chared.c_kill.mark; - } - return CC_REFRESH; -} - - -/* em_copy_region(): - * Copy area between mark and cursor to cut buffer - * [M-W] - */ -protected el_action_t -/*ARGSUSED*/ -em_copy_region(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *kp, *cp; - - if (!el->el_chared.c_kill.mark) - return CC_ERROR; - - if (el->el_chared.c_kill.mark > el->el_line.cursor) { - cp = el->el_line.cursor; - kp = el->el_chared.c_kill.buf; - while (cp < el->el_chared.c_kill.mark) - *kp++ = *cp++; /* copy it */ - el->el_chared.c_kill.last = kp; - } else { - cp = el->el_chared.c_kill.mark; - kp = el->el_chared.c_kill.buf; - while (cp < el->el_line.cursor) - *kp++ = *cp++; /* copy it */ - el->el_chared.c_kill.last = kp; - } - return CC_NORM; -} - - -/* em_gosmacs_transpose(): - * Exchange the two characters before the cursor - * Gosling emacs transpose chars [^T] - */ -protected el_action_t -em_gosmacs_transpose(EditLine *el, Int c) -{ - - if (el->el_line.cursor > &el->el_line.buffer[1]) { - /* must have at least two chars entered */ - c = el->el_line.cursor[-2]; - el->el_line.cursor[-2] = el->el_line.cursor[-1]; - el->el_line.cursor[-1] = c; - return CC_REFRESH; - } else - return CC_ERROR; -} - - -/* em_next_word(): - * Move next to end of current word - * [M-f] - */ -protected el_action_t -/*ARGSUSED*/ -em_next_word(EditLine *el, Int c __attribute__((__unused__))) -{ - if (el->el_line.cursor == el->el_line.lastchar) - return CC_ERROR; - - el->el_line.cursor = c__next_word(el->el_line.cursor, - el->el_line.lastchar, - el->el_state.argument, - ce__isword); - - if (el->el_map.type == MAP_VI) - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* em_upper_case(): - * Uppercase the characters from cursor to end of current word - * [M-u] - */ -protected el_action_t -/*ARGSUSED*/ -em_upper_case(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *cp, *ep; - - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, - el->el_state.argument, ce__isword); - - for (cp = el->el_line.cursor; cp < ep; cp++) - if (Islower(*cp)) - *cp = Toupper(*cp); - - el->el_line.cursor = ep; - if (el->el_line.cursor > el->el_line.lastchar) - el->el_line.cursor = el->el_line.lastchar; - return CC_REFRESH; -} - - -/* em_capitol_case(): - * Capitalize the characters from cursor to end of current word - * [M-c] - */ -protected el_action_t -/*ARGSUSED*/ -em_capitol_case(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *cp, *ep; - - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, - el->el_state.argument, ce__isword); - - for (cp = el->el_line.cursor; cp < ep; cp++) { - if (Isalpha(*cp)) { - if (Islower(*cp)) - *cp = Toupper(*cp); - cp++; - break; - } - } - for (; cp < ep; cp++) - if (Isupper(*cp)) - *cp = Tolower(*cp); - - el->el_line.cursor = ep; - if (el->el_line.cursor > el->el_line.lastchar) - el->el_line.cursor = el->el_line.lastchar; - return CC_REFRESH; -} - - -/* em_lower_case(): - * Lowercase the characters from cursor to end of current word - * [M-l] - */ -protected el_action_t -/*ARGSUSED*/ -em_lower_case(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *cp, *ep; - - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, - el->el_state.argument, ce__isword); - - for (cp = el->el_line.cursor; cp < ep; cp++) - if (Isupper(*cp)) - *cp = Tolower(*cp); - - el->el_line.cursor = ep; - if (el->el_line.cursor > el->el_line.lastchar) - el->el_line.cursor = el->el_line.lastchar; - return CC_REFRESH; -} - - -/* em_set_mark(): - * Set the mark at cursor - * [^@] - */ -protected el_action_t -/*ARGSUSED*/ -em_set_mark(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_chared.c_kill.mark = el->el_line.cursor; - return CC_NORM; -} - - -/* em_exchange_mark(): - * Exchange the cursor and mark - * [^X^X] - */ -protected el_action_t -/*ARGSUSED*/ -em_exchange_mark(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *cp; - - cp = el->el_line.cursor; - el->el_line.cursor = el->el_chared.c_kill.mark; - el->el_chared.c_kill.mark = cp; - return CC_CURSOR; -} - - -/* em_universal_argument(): - * Universal argument (argument times 4) - * [^U] - */ -protected el_action_t -/*ARGSUSED*/ -em_universal_argument(EditLine *el, Int c __attribute__((__unused__))) -{ /* multiply current argument by 4 */ - - if (el->el_state.argument > 1000000) - return CC_ERROR; - el->el_state.doingarg = 1; - el->el_state.argument *= 4; - return CC_ARGHACK; -} - - -/* em_meta_next(): - * Add 8th bit to next character typed - * [] - */ -protected el_action_t -/*ARGSUSED*/ -em_meta_next(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_state.metanext = 1; - return CC_ARGHACK; -} - - -/* em_toggle_overwrite(): - * Switch from insert to overwrite mode or vice versa - */ -protected el_action_t -/*ARGSUSED*/ -em_toggle_overwrite(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_state.inputmode = (el->el_state.inputmode == MODE_INSERT) ? - MODE_REPLACE : MODE_INSERT; - return CC_NORM; -} - - -/* em_copy_prev_word(): - * Copy current word to cursor - */ -protected el_action_t -/*ARGSUSED*/ -em_copy_prev_word(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *cp, *oldc, *dp; - - if (el->el_line.cursor == el->el_line.buffer) - return CC_ERROR; - - oldc = el->el_line.cursor; - /* does a bounds check */ - cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, - el->el_state.argument, ce__isword); - - c_insert(el, (int)(oldc - cp)); - for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) - *dp++ = *cp; - - el->el_line.cursor = dp;/* put cursor at end */ - - return CC_REFRESH; -} - - -/* em_inc_search_next(): - * Emacs incremental next search - */ -protected el_action_t -/*ARGSUSED*/ -em_inc_search_next(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_search.patlen = 0; - return ce_inc_search(el, ED_SEARCH_NEXT_HISTORY); -} - - -/* em_inc_search_prev(): - * Emacs incremental reverse search - */ -protected el_action_t -/*ARGSUSED*/ -em_inc_search_prev(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_search.patlen = 0; - return ce_inc_search(el, ED_SEARCH_PREV_HISTORY); -} - - -/* em_delete_prev_char(): - * Delete the character to the left of the cursor - * [^?] - */ -protected el_action_t -/*ARGSUSED*/ -em_delete_prev_char(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor <= el->el_line.buffer) - return CC_ERROR; - - if (el->el_state.doingarg) - c_delbefore(el, el->el_state.argument); - else - c_delbefore1(el); - el->el_line.cursor -= el->el_state.argument; - if (el->el_line.cursor < el->el_line.buffer) - el->el_line.cursor = el->el_line.buffer; - return CC_REFRESH; -} diff --git a/cmd-line-utils/libedit/filecomplete.c b/cmd-line-utils/libedit/filecomplete.c deleted file mode 100644 index b67b54510bf..00000000000 --- a/cmd-line-utils/libedit/filecomplete.c +++ /dev/null @@ -1,612 +0,0 @@ -/* $NetBSD: filecomplete.c,v 1.31 2011/09/16 16:13:16 plunky Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jaromir Dolecek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* AIX requires this to be the first thing in the file. */ -#if defined (_AIX) && !defined (__GNUC__) - #pragma alloca -#endif - -#include "config.h" - -/* XXXMYSQL */ -#ifdef __GNUC__ -# undef alloca -# define alloca(n) __builtin_alloca (n) -#else -# ifdef HAVE_ALLOCA_H -# include -# else -# ifndef _AIX -extern char *alloca (); -# endif -# endif -#endif - -#if !defined(lint) && !defined(SCCSID) -#endif /* not lint && not SCCSID */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_VIS_H -#include -#else -#include "np/vis.h" -#endif -#ifdef HAVE_ALLOCA_H -#include -#endif -#include "el.h" -#include "fcns.h" /* for EL_NUM_FCNS */ -#include "histedit.h" -#include "filecomplete.h" - -static const Char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', - '$', '>', '<', '=', ';', '|', '&', '{', '(', '\0' }; - - -/********************************/ -/* completion functions */ - -/* - * does tilde expansion of strings of type ``~user/foo'' - * if ``user'' isn't valid user name or ``txt'' doesn't start - * w/ '~', returns pointer to strdup()ed copy of ``txt'' - * - * it's callers's responsibility to free() returned string - */ -char * -fn_tilde_expand(const char *txt) -{ -#if defined(HAVE_GETPW_R_POSIX) || defined(HAVE_GETPW_R_DRAFT) - struct passwd pwres; - char pwbuf[1024]; -#endif - struct passwd *pass; - char *temp; - size_t len = 0; - - if (txt[0] != '~') - return strdup(txt); - - temp = strchr(txt + 1, '/'); - if (temp == NULL) { - temp = strdup(txt + 1); - if (temp == NULL) - return NULL; - } else { - /* text until string after slash */ - len = (size_t)(temp - txt + 1); - temp = el_malloc(len * sizeof(*temp)); - if (temp == NULL) - return NULL; - (void)strncpy(temp, txt + 1, len - 2); - temp[len - 2] = '\0'; - } - if (temp[0] == 0) { -#ifdef HAVE_GETPW_R_POSIX - if (getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf), - &pass) != 0) - pass = NULL; -#elif HAVE_GETPW_R_DRAFT - pass = getpwuid_r(getuid(), &pwres, pwbuf, sizeof(pwbuf)); -#else - pass = getpwuid(getuid()); -#endif - } else { -#ifdef HAVE_GETPW_R_POSIX - if (getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf), &pass) != 0) - pass = NULL; -#elif HAVE_GETPW_R_DRAFT - pass = getpwnam_r(temp, &pwres, pwbuf, sizeof(pwbuf)); -#else - pass = getpwnam(temp); -#endif - } - el_free(temp); /* value no more needed */ - if (pass == NULL) - return strdup(txt); - - /* update pointer txt to point at string immedially following */ - /* first slash */ - txt += len; - - len = strlen(pass->pw_dir) + 1 + strlen(txt) + 1; - temp = el_malloc(len * sizeof(*temp)); - if (temp == NULL) - return NULL; - (void)snprintf(temp, len, "%s/%s", pass->pw_dir, txt); - - return temp; -} - - -/* - * return first found file name starting by the ``text'' or NULL if no - * such file can be found - * value of ``state'' is ignored - * - * it's caller's responsibility to free returned string - */ -char * -fn_filename_completion_function(const char *text, int state) -{ - static DIR *dir = NULL; - static char *filename = NULL, *dirname = NULL, *dirpath = NULL; - static size_t filename_len = 0; - struct dirent *entry; - char *temp; - size_t len; - - if (state == 0 || dir == NULL) { - temp = strrchr(text, '/'); - if (temp) { - char *nptr; - temp++; - nptr = el_realloc(filename, (strlen(temp) + 1) * - sizeof(*nptr)); - if (nptr == NULL) { - el_free(filename); - filename = NULL; - return NULL; - } - filename = nptr; - (void)strcpy(filename, temp); - len = (size_t)(temp - text); /* including last slash */ - - nptr = el_realloc(dirname, (len + 1) * - sizeof(*nptr)); - if (nptr == NULL) { - el_free(dirname); - dirname = NULL; - return NULL; - } - dirname = nptr; - (void)strncpy(dirname, text, len); - dirname[len] = '\0'; - } else { - el_free(filename); - if (*text == 0) - filename = NULL; - else { - filename = strdup(text); - if (filename == NULL) - return NULL; - } - el_free(dirname); - dirname = NULL; - } - - if (dir != NULL) { - (void)closedir(dir); - dir = NULL; - } - - /* support for ``~user'' syntax */ - - el_free(dirpath); - dirpath = NULL; - if (dirname == NULL) { - if ((dirname = strdup("")) == NULL) - return NULL; - dirpath = strdup("./"); - } else if (*dirname == '~') - dirpath = fn_tilde_expand(dirname); - else - dirpath = strdup(dirname); - - if (dirpath == NULL) - return NULL; - - dir = opendir(dirpath); - if (!dir) - return NULL; /* cannot open the directory */ - - /* will be used in cycle */ - filename_len = filename ? strlen(filename) : 0; - } - - /* find the match */ - while ((entry = readdir(dir)) != NULL) { - /* skip . and .. */ - if (entry->d_name[0] == '.' && (!entry->d_name[1] - || (entry->d_name[1] == '.' && !entry->d_name[2]))) - continue; - if (filename_len == 0) - break; - /* otherwise, get first entry where first */ - /* filename_len characters are equal */ - if (entry->d_name[0] == filename[0] -#if HAVE_STRUCT_DIRENT_D_NAMLEN - && entry->d_namlen >= filename_len -#else - && strlen(entry->d_name) >= filename_len -#endif - && strncmp(entry->d_name, filename, - filename_len) == 0) - break; - } - - if (entry) { /* match found */ - -#if HAVE_STRUCT_DIRENT_D_NAMLEN - len = entry->d_namlen; -#else - len = strlen(entry->d_name); -#endif - - len = strlen(dirname) + len + 1; - temp = el_malloc(len * sizeof(*temp)); - if (temp == NULL) - return NULL; - (void)snprintf(temp, len, "%s%s", dirname, entry->d_name); - } else { - (void)closedir(dir); - dir = NULL; - temp = NULL; - } - - return temp; -} - - -static const char * -append_char_function(const char *name) -{ - struct stat stbuf; - char *expname = *name == '~' ? fn_tilde_expand(name) : NULL; - const char *rs = " "; - - if (stat(expname ? expname : name, &stbuf) == -1) - goto out; - if (S_ISDIR(stbuf.st_mode)) - rs = "/"; -out: - if (expname) - el_free(expname); - return rs; -} -/* - * returns list of completions for text given - * non-static for readline. - */ -char ** completion_matches(const char *, char *(*)(const char *, int)); -char ** -completion_matches(const char *text, char *(*genfunc)(const char *, int)) -{ - char **match_list = NULL, *retstr, *prevstr; - size_t match_list_len, max_equal, which, i; - size_t matches; - - matches = 0; - match_list_len = 1; - while ((retstr = (*genfunc) (text, (int)matches)) != NULL) { - /* allow for list terminator here */ - if (matches + 3 >= match_list_len) { - char **nmatch_list; - while (matches + 3 >= match_list_len) - match_list_len <<= 1; - nmatch_list = el_realloc(match_list, - match_list_len * sizeof(*nmatch_list)); - if (nmatch_list == NULL) { - el_free(match_list); - return NULL; - } - match_list = nmatch_list; - - } - match_list[++matches] = retstr; - } - - if (!match_list) - return NULL; /* nothing found */ - - /* find least denominator and insert it to match_list[0] */ - which = 2; - prevstr = match_list[1]; - max_equal = strlen(prevstr); - for (; which <= matches; which++) { - for (i = 0; i < max_equal && - prevstr[i] == match_list[which][i]; i++) - continue; - max_equal = i; - } - - retstr = el_malloc((max_equal + 1) * sizeof(*retstr)); - if (retstr == NULL) { - el_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 */ - match_list[matches + 1] = NULL; - - return match_list; -} - -/* - * Sort function for qsort(). Just wrapper around strcasecmp(). - */ -static int -_fn_qsort_string_compare(const void *i1, const void *i2) -{ - const char *s1 = ((const char * const *)i1)[0]; - const char *s2 = ((const char * const *)i2)[0]; - - return strcasecmp(s1, s2); -} - -/* - * Display list of strings in columnar format on readline's output stream. - * 'matches' is list of strings, 'num' is number of strings in 'matches', - * 'width' is maximum length of string in 'matches'. - * - * matches[0] is not one of the match strings, but it is counted in - * num, so the strings are matches[1] *through* matches[num-1]. - */ -void -fn_display_match_list (EditLine *el, char **matches, size_t num, size_t width) -{ - size_t line, lines, col, cols, thisguy; - int screenwidth = el->el_terminal.t_size.h; - - /* Ignore matches[0]. Avoid 1-based array logic below. */ - matches++; - num--; - - /* - * Find out how many entries can be put on one line; count - * with one space between strings the same way it's printed. - */ - cols = (size_t)screenwidth / (width + 1); - if (cols == 0) - cols = 1; - - /* how many lines of output, rounded up */ - lines = (num + cols - 1) / cols; - - /* Sort the items. */ - qsort(matches, num, sizeof(char *), _fn_qsort_string_compare); - - /* - * On the ith line print elements i, i+lines, i+lines*2, etc. - */ - for (line = 0; line < lines; line++) { - for (col = 0; col < cols; col++) { - thisguy = line + col * lines; - if (thisguy >= num) - break; - (void)fprintf(el->el_outfile, "%s%-*s", - col == 0 ? "" : " ", (int)width, matches[thisguy]); - } - (void)fprintf(el->el_outfile, "\n"); - } -} - -/* - * Complete the word at or before point, - * 'what_to_do' says what to do with the completion. - * \t means do standard completion. - * `?' means list the possible completions. - * `*' means insert all of the possible completions. - * `!' means to do standard completion, and list all possible completions if - * there is more than one. - * - * Note: '*' support is not implemented - * '!' could never be invoked - */ -int -fn_complete(EditLine *el, - char *(*complet_func)(const char *, int), - char **(*attempted_completion_function)(const char *, int, int), - const Char *word_break, const Char *special_prefixes, - const char *(*app_func)(const char *), size_t query_items, - int *completion_type, int *over, int *point, int *end) -{ - const TYPE(LineInfo) *li; - Char *temp; - char **matches; - const Char *ctemp; - size_t len; - int what_to_do = '\t'; - int retval = CC_NORM; - - if (el->el_state.lastcmd == el->el_state.thiscmd) - what_to_do = '?'; - - /* readline's rl_complete() has to be told what we did... */ - if (completion_type != NULL) - *completion_type = what_to_do; - - if (!complet_func) - complet_func = fn_filename_completion_function; - if (!app_func) - app_func = append_char_function; - - /* We now look backwards for the start of a filename/variable word */ - li = FUN(el,line)(el); - ctemp = li->cursor; - while (ctemp > li->buffer - && !Strchr(word_break, ctemp[-1]) - && (!special_prefixes || !Strchr(special_prefixes, ctemp[-1]) ) ) - ctemp--; - - len = (size_t)(li->cursor - ctemp); -#if defined(__SSP__) || defined(__SSP_ALL__) - temp = el_malloc((len + 1) * sizeof(*temp)); -#else - temp = alloca((len + 1) * sizeof(*temp)); -#endif - (void)Strncpy(temp, ctemp, len); - temp[len] = '\0'; - - /* these can be used by function called in completion_matches() */ - /* or (*attempted_completion_function)() */ - if (point != 0) - *point = (int)(li->cursor - li->buffer); - if (end != NULL) - *end = (int)(li->lastchar - li->buffer); - - if (attempted_completion_function) { - int cur_off = (int)(li->cursor - li->buffer); - matches = (*attempted_completion_function)( - ct_encode_string(temp, &el->el_scratch), - cur_off - (int)len, cur_off); - } else - matches = 0; - if (!attempted_completion_function || - (over != NULL && !*over && !matches)) - matches = completion_matches( - ct_encode_string(temp, &el->el_scratch), complet_func); - - if (over != NULL) - *over = 0; - - if (matches) { - int i; - size_t matches_num, maxlen, match_len, match_display=1; - - retval = CC_REFRESH; - /* - * Only replace the completed string with common part of - * possible matches if there is possible completion. - */ - if (matches[0][0] != '\0') { - el_deletestr(el, (int) len); - FUN(el,insertstr)(el, - ct_decode_string(matches[0], &el->el_scratch)); - } - - if (what_to_do == '?') - goto display_matches; - - if (matches[2] == NULL && strcmp(matches[0], matches[1]) == 0) { - /* - * We found exact match. Add a space after - * it, unless we do filename completion and the - * object is a directory. - */ - FUN(el,insertstr)(el, - ct_decode_string((*app_func)(matches[0]), - &el->el_scratch)); - } else if (what_to_do == '!') { - display_matches: - /* - * More than one match and requested to list possible - * matches. - */ - - for(i = 1, maxlen = 0; matches[i]; i++) { - match_len = strlen(matches[i]); - if (match_len > maxlen) - maxlen = match_len; - } - /* matches[1] through matches[i-1] are available */ - matches_num = (size_t)(i - 1); - - /* newline to get on next line from command line */ - (void)fprintf(el->el_outfile, "\n"); - - /* - * If there are too many items, ask user for display - * confirmation. - */ - if (matches_num > query_items) { - (void)fprintf(el->el_outfile, - "Display all %zu possibilities? (y or n) ", - matches_num); - (void)fflush(el->el_outfile); - if (getc(stdin) != 'y') - match_display = 0; - (void)fprintf(el->el_outfile, "\n"); - } - - if (match_display) { - /* - * Interface of this function requires the - * strings be matches[1..num-1] for compat. - * We have matches_num strings not counting - * the prefix in matches[0], so we need to - * add 1 to matches_num for the call. - */ - fn_display_match_list(el, matches, - matches_num+1, maxlen); - } - retval = CC_REDISPLAY; - } else if (matches[0][0]) { - /* - * There was some common match, but the name was - * not complete enough. Next tab will print possible - * completions. - */ - el_beep(el); - } else { - /* lcd is not a valid object - further specification */ - /* is needed */ - el_beep(el); - retval = CC_NORM; - } - - /* free elements of array and the array itself */ - for (i = 0; matches[i]; i++) - el_free(matches[i]); - el_free(matches); - matches = NULL; - } -#if defined(__SSP__) || defined(__SSP_ALL__) - el_free(temp); -#endif - return retval; -} - -/* - * el-compatible wrapper around rl_complete; needed for key binding - */ -/* ARGSUSED */ -unsigned char -_el_fn_complete(EditLine *el, int ch __attribute__((__unused__))) -{ - return (unsigned char)fn_complete(el, NULL, NULL, - break_chars, NULL, NULL, (size_t)100, - NULL, NULL, NULL, NULL); -} diff --git a/cmd-line-utils/libedit/filecomplete.h b/cmd-line-utils/libedit/filecomplete.h deleted file mode 100644 index 971e6e05939..00000000000 --- a/cmd-line-utils/libedit/filecomplete.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: filecomplete.h,v 1.9 2009/12/30 22:37:40 christos Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jaromir Dolecek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _FILECOMPLETE_H_ -#define _FILECOMPLETE_H_ - -int fn_complete(EditLine *, - char *(*)(const char *, int), - char **(*)(const char *, int, int), - const Char *, const Char *, const char *(*)(const char *), size_t, - int *, int *, int *, int *); - -void fn_display_match_list(EditLine *, char **, size_t, size_t); -char *fn_tilde_expand(const char *); -char *fn_filename_completion_function(const char *, int); - -#endif diff --git a/cmd-line-utils/libedit/hist.c b/cmd-line-utils/libedit/hist.c deleted file mode 100644 index d24f5e7ff53..00000000000 --- a/cmd-line-utils/libedit/hist.c +++ /dev/null @@ -1,222 +0,0 @@ -/* $NetBSD: hist.c,v 1.20 2011/07/29 15:16:33 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * hist.c: History access functions - */ -#include -#include "el.h" - -/* hist_init(): - * Initialization function. - */ -protected int -hist_init(EditLine *el) -{ - - el->el_history.fun = NULL; - el->el_history.ref = NULL; - el->el_history.buf = el_malloc(EL_BUFSIZ * sizeof(*el->el_history.buf)); - el->el_history.sz = EL_BUFSIZ; - if (el->el_history.buf == NULL) - return -1; - el->el_history.last = el->el_history.buf; - return 0; -} - - -/* hist_end(): - * clean up history; - */ -protected void -hist_end(EditLine *el) -{ - - el_free(el->el_history.buf); - el->el_history.buf = NULL; -} - - -/* hist_set(): - * Set new history interface - */ -protected int -hist_set(EditLine *el, hist_fun_t fun, void *ptr) -{ - - el->el_history.ref = ptr; - el->el_history.fun = fun; - return 0; -} - - -/* hist_get(): - * Get a history line and update it in the buffer. - * eventno tells us the event to get. - */ -protected el_action_t -hist_get(EditLine *el) -{ - const Char *hp; - int h; - - if (el->el_history.eventno == 0) { /* if really the current line */ - (void) Strncpy(el->el_line.buffer, el->el_history.buf, - el->el_history.sz); - el->el_line.lastchar = el->el_line.buffer + - (el->el_history.last - el->el_history.buf); - -#ifdef KSHVI - if (el->el_map.type == MAP_VI) - el->el_line.cursor = el->el_line.buffer; - else -#endif /* KSHVI */ - el->el_line.cursor = el->el_line.lastchar; - - return CC_REFRESH; - } - if (el->el_history.ref == NULL) - return CC_ERROR; - - hp = HIST_FIRST(el); - - if (hp == NULL) - return CC_ERROR; - - for (h = 1; h < el->el_history.eventno; h++) - if ((hp = HIST_NEXT(el)) == NULL) { - el->el_history.eventno = h; - return CC_ERROR; - } - (void) Strncpy(el->el_line.buffer, hp, - (size_t)(el->el_line.limit - el->el_line.buffer)); - el->el_line.buffer[el->el_line.limit - el->el_line.buffer - 1] = '\0'; - el->el_line.lastchar = el->el_line.buffer + Strlen(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; - else -#endif /* KSHVI */ - el->el_line.cursor = el->el_line.lastchar; - - return CC_REFRESH; -} - - -/* hist_command() - * process a history command - */ -protected int -hist_command(EditLine *el, int argc, const Char **argv) -{ - const Char *str; - int num; - TYPE(HistEvent) ev; - - if (el->el_history.ref == NULL) - return -1; - - if (argc == 1 || Strcmp(argv[1], STR("list")) == 0) { - /* 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, ct_encode_string(str, &el->el_scratch)); - return 0; - } - - if (argc != 3) - return -1; - - num = (int)Strtol(argv[2], NULL, 0); - - if (Strcmp(argv[1], STR("size")) == 0) - return FUNW(history)(el->el_history.ref, &ev, H_SETSIZE, num); - - if (Strcmp(argv[1], STR("unique")) == 0) - return FUNW(history)(el->el_history.ref, &ev, H_SETUNIQUE, num); - - return -1; -} - -/* hist_enlargebuf() - * Enlarge history buffer to specified value. Called from el_enlargebufs(). - * Return 0 for failure, 1 for success. - */ -protected int -/*ARGSUSED*/ -hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz) -{ - Char *newbuf; - - newbuf = el_realloc(el->el_history.buf, newsz * sizeof(*newbuf)); - if (!newbuf) - return 0; - - (void) memset(&newbuf[oldsz], '\0', (newsz - oldsz) * sizeof(*newbuf)); - - el->el_history.last = newbuf + - (el->el_history.last - el->el_history.buf); - el->el_history.buf = newbuf; - el->el_history.sz = newsz; - - return 1; -} - -#ifdef WIDECHAR -protected wchar_t * -hist_convert(EditLine *el, int fn, void *arg) -{ - HistEventW ev; - if ((*(el)->el_history.fun)((el)->el_history.ref, &ev, fn, arg) == -1) - return NULL; - return ct_decode_string((const char *)(const void *)ev.str, - &el->el_scratch); -} -#endif diff --git a/cmd-line-utils/libedit/hist.h b/cmd-line-utils/libedit/hist.h deleted file mode 100644 index a63be499dbd..00000000000 --- a/cmd-line-utils/libedit/hist.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $NetBSD: hist.h,v 1.13 2011/07/28 20:50:55 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)hist.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.hist.c: History functions - */ -#ifndef _h_el_hist -#define _h_el_hist - -#include "histedit.h" - -typedef int (*hist_fun_t)(void *, TYPE(HistEvent) *, int, ...); - -typedef struct el_history_t { - Char *buf; /* The history buffer */ - size_t sz; /* Size of history buffer */ - Char *last; /* The last character */ - int eventno; /* Event we are looking for */ - void * ref; /* Argument for history fcns */ - hist_fun_t fun; /* Event access */ - TYPE(HistEvent) ev; /* Event cookie */ -} el_history_t; - -#define HIST_FUN_INTERNAL(el, fn, arg) \ - ((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, \ - fn, arg)) == -1) ? NULL : (el)->el_history.ev.str) -#ifdef WIDECHAR -#define HIST_FUN(el, fn, arg) \ - (((el)->el_flags & NARROW_HISTORY) ? hist_convert(el, fn, arg) : \ - HIST_FUN_INTERNAL(el, fn, arg)) -#else -#define HIST_FUN(el, fn, arg) HIST_FUN_INTERNAL(el, fn, arg) -#endif - - -#define HIST_NEXT(el) HIST_FUN(el, H_NEXT, NULL) -#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_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) - -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, void *); -protected int hist_command(EditLine *, int, const Char **); -protected int hist_enlargebuf(EditLine *, size_t, size_t); -#ifdef WIDECHAR -protected wchar_t *hist_convert(EditLine *, int, void *); -#endif - -#endif /* _h_el_hist */ diff --git a/cmd-line-utils/libedit/histedit.h b/cmd-line-utils/libedit/histedit.h deleted file mode 100644 index 523d27b0be2..00000000000 --- a/cmd-line-utils/libedit/histedit.h +++ /dev/null @@ -1,315 +0,0 @@ -/* $NetBSD: histedit.h,v 1.48 2011/07/28 20:50:55 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)histedit.h 8.2 (Berkeley) 1/3/94 - */ - -/* - * histedit.h: Line editor and history interface. - */ -#ifndef _HISTEDIT_H_ -#define _HISTEDIT_H_ - -#define LIBEDIT_MAJOR 2 -#define LIBEDIT_MINOR 11 - -/* XXXMYSQL : stdint.h might not be available on older Solaris platforms. */ -#if defined(__sun) || defined(__sun__) -#include -#else -#include -#endif - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * ==== Editing ==== - */ - -typedef struct editline EditLine; - -/* - * For user-defined function interface - */ -typedef struct lineinfo { - const char *buffer; - const char *cursor; - const char *lastchar; -} LineInfo; - -/* - * EditLine editor function return codes. - * For user-defined function interface - */ -#define CC_NORM 0 -#define CC_NEWLINE 1 -#define CC_EOF 2 -#define CC_ARGHACK 3 -#define CC_REFRESH 4 -#define CC_CURSOR 5 -#define CC_ERROR 6 -#define CC_FATAL 7 -#define CC_REDISPLAY 8 -#define CC_REFRESH_BEEP 9 - -/* - * Initialization, cleanup, and resetting - */ -EditLine *el_init(const char *, FILE *, FILE *, FILE *); -void el_end(EditLine *); -void el_reset(EditLine *); - -/* - * Get a line, a character or push a string back in the input queue - */ -const char *el_gets(EditLine *, int *); -int el_getc(EditLine *, char *); -void el_push(EditLine *, const char *); - -/* - * Beep! - */ -void el_beep(EditLine *); - -/* - * High level function internals control - * Parses argc, argv array and executes builtin editline commands - */ -int el_parse(EditLine *, int, const char **); - -/* - * Low level editline access functions - */ -int el_set(EditLine *, int, ...); -int el_get(EditLine *, int, ...); -unsigned char _el_fn_complete(EditLine *, int); - -/* - * el_set/el_get parameters - * - * When using el_wset/el_wget (as opposed to el_set/el_get): - * Char is wchar_t, otherwise it is char. - * prompt_func is el_wpfunc_t, otherwise it is el_pfunc_t . - - * Prompt function prototypes are: - * typedef char *(*el_pfunct_t) (EditLine *); - * typedef wchar_t *(*el_wpfunct_t) (EditLine *); - * - * For operations that support set or set/get, the argument types listed are for - * the "set" operation. For "get", each listed type must be a pointer. - * E.g. EL_EDITMODE takes an int when set, but an int* when get. - * - * Operations that only support "get" have the correct argument types listed. - */ -#define EL_PROMPT 0 /* , prompt_func); set/get */ -#define EL_TERMINAL 1 /* , const char *); set/get */ -#define EL_EDITOR 2 /* , const Char *); set/get */ -#define EL_SIGNAL 3 /* , int); set/get */ -#define EL_BIND 4 /* , const Char *, ..., NULL); set */ -#define EL_TELLTC 5 /* , const Char *, ..., NULL); set */ -#define EL_SETTC 6 /* , const Char *, ..., NULL); set */ -#define EL_ECHOTC 7 /* , const Char *, ..., NULL); set */ -#define EL_SETTY 8 /* , const Char *, ..., NULL); set */ -#define EL_ADDFN 9 /* , const Char *, const Char, set */ - /* el_func_t); */ -#define EL_HIST 10 /* , hist_fun_t, const void *); set */ -#define EL_EDITMODE 11 /* , int); set/get */ -#define EL_RPROMPT 12 /* , prompt_func); set/get */ -#define EL_GETCFN 13 /* , el_rfunc_t); set/get */ -#define EL_CLIENTDATA 14 /* , void *); set/get */ -#define EL_UNBUFFERED 15 /* , int); set/get */ -#define EL_PREP_TERM 16 /* , int); set */ -#define EL_GETTC 17 /* , const Char *, ..., NULL); get */ -#define EL_GETFP 18 /* , int, FILE **); get */ -#define EL_SETFP 19 /* , int, FILE *); set */ -#define EL_REFRESH 20 /* , void); set */ -#define EL_PROMPT_ESC 21 /* , prompt_func, Char); set/get */ -#define EL_RPROMPT_ESC 22 /* , prompt_func, Char); set/get */ -#define EL_RESIZE 23 /* , el_zfunc_t, void *); set */ - -#define EL_BUILTIN_GETCFN (NULL) - -/* - * Source named file or $PWD/.editrc or $HOME/.editrc - */ -int el_source(EditLine *, const char *); - -/* - * Must be called when the terminal changes size; If EL_SIGNAL - * is set this is done automatically otherwise it is the responsibility - * of the application - */ -void el_resize(EditLine *); - -/* - * User-defined function interface. - */ -const LineInfo *el_line(EditLine *); -int el_insertstr(EditLine *, const char *); -void el_deletestr(EditLine *, int); - - -/* - * ==== History ==== - */ - -typedef struct history History; - -typedef struct HistEvent { - int num; - const char *str; -} HistEvent; - -/* - * History access functions. - */ -History * history_init(void); -void history_end(History *); - -int history(History *, HistEvent *, int, ...); - -#define H_FUNC 0 /* , UTSL */ -#define H_SETSIZE 1 /* , const int); */ -#define H_GETSIZE 2 /* , void); */ -#define H_FIRST 3 /* , void); */ -#define H_LAST 4 /* , void); */ -#define H_PREV 5 /* , void); */ -#define H_NEXT 6 /* , void); */ -#define H_CURR 8 /* , const int); */ -#define H_SET 7 /* , int); */ -#define H_ADD 9 /* , const wchar_t *); */ -#define H_ENTER 10 /* , const wchar_t *); */ -#define H_APPEND 11 /* , const wchar_t *); */ -#define H_END 12 /* , void); */ -#define H_NEXT_STR 13 /* , const wchar_t *); */ -#define H_PREV_STR 14 /* , const wchar_t *); */ -#define H_NEXT_EVENT 15 /* , const int); */ -#define H_PREV_EVENT 16 /* , const 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); */ -#define H_DEL 22 /* , int); */ -#define H_NEXT_EVDATA 23 /* , const int, histdata_t *); */ -#define H_DELDATA 24 /* , int, histdata_t *);*/ -#define H_REPLACE 25 /* , const char *, histdata_t); */ - - - -/* - * ==== Tokenization ==== - */ - -typedef struct tokenizer Tokenizer; - -/* - * String tokenization functions, using simplified sh(1) quoting rules - */ -Tokenizer *tok_init(const char *); -void tok_end(Tokenizer *); -void tok_reset(Tokenizer *); -int tok_line(Tokenizer *, const LineInfo *, - int *, const char ***, int *, int *); -int tok_str(Tokenizer *, const char *, - int *, const char ***); - -/* - * Begin Wide Character Support - */ - -/* - * Wide character versions - */ - -/* - * ==== Editing ==== - */ -typedef struct lineinfow { - const wchar_t *buffer; - const wchar_t *cursor; - const wchar_t *lastchar; -} LineInfoW; - -const wchar_t *el_wgets(EditLine *, int *); -int el_wgetc(EditLine *, wchar_t *); -void el_wpush(EditLine *, const wchar_t *); - -int el_wparse(EditLine *, int, const wchar_t **); - -int el_wset(EditLine *, int, ...); -int el_wget(EditLine *, int, ...); - -const LineInfoW *el_wline(EditLine *); -int el_winsertstr(EditLine *, const wchar_t *); -#define el_wdeletestr el_deletestr - -/* - * ==== History ==== - */ -typedef struct histeventW { - int num; - const wchar_t *str; -} HistEventW; - -typedef struct historyW HistoryW; - -HistoryW * history_winit(void); -void history_wend(HistoryW *); - -int history_w(HistoryW *, HistEventW *, int, ...); - -/* - * ==== Tokenization ==== - */ -typedef struct tokenizerW TokenizerW; - -/* Wide character tokenizer support */ -TokenizerW *tok_winit(const wchar_t *); -void tok_wend(TokenizerW *); -void tok_wreset(TokenizerW *); -int tok_wline(TokenizerW *, const LineInfoW *, - int *, const wchar_t ***, int *, int *); -int tok_wstr(TokenizerW *, const wchar_t *, - int *, const wchar_t ***); - -#ifdef __cplusplus -} -#endif - -#endif /* _HISTEDIT_H_ */ diff --git a/cmd-line-utils/libedit/history.c b/cmd-line-utils/libedit/history.c deleted file mode 100644 index 6d2176c258b..00000000000 --- a/cmd-line-utils/libedit/history.c +++ /dev/null @@ -1,1102 +0,0 @@ -/* $NetBSD: history.c,v 1.45 2011/07/29 23:44:44 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * hist.c: TYPE(History) access functions - */ -#include -#include -#include -#ifdef HAVE_VIS_H -#include -#else -#include "np/vis.h" -#endif -#include - -static const char hist_cookie[] = "_HiStOrY_V2_\n"; - -#include "histedit.h" -#include "chartype.h" - -typedef int (*history_gfun_t)(void *, TYPE(HistEvent) *); -typedef int (*history_efun_t)(void *, TYPE(HistEvent) *, const Char *); -typedef void (*history_vfun_t)(void *, TYPE(HistEvent) *); -typedef int (*history_sfun_t)(void *, TYPE(HistEvent) *, const int); - -struct TYPE(history) { - void *h_ref; /* Argument for history fcns */ - int h_ent; /* Last entry point for history */ - history_gfun_t h_first; /* Get the first element */ - history_gfun_t h_next; /* Get the next element */ - history_gfun_t h_last; /* Get the last element */ - history_gfun_t h_prev; /* Get the previous element */ - history_gfun_t h_curr; /* Get the current element */ - history_sfun_t h_set; /* Set the current element */ - history_sfun_t h_del; /* Set the given element */ - history_vfun_t h_clear; /* Clear the history list */ - 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) -#define HLAST(h, ev) (*(h)->h_last)((h)->h_ref, ev) -#define HCURR(h, ev) (*(h)->h_curr)((h)->h_ref, ev) -#define HSET(h, ev, n) (*(h)->h_set)((h)->h_ref, ev, n) -#define HCLEAR(h, ev) (*(h)->h_clear)((h)->h_ref, ev) -#define HENTER(h, ev, str) (*(h)->h_enter)((h)->h_ref, ev, str) -#define HADD(h, ev, str) (*(h)->h_add)((h)->h_ref, ev, str) -#define HDEL(h, ev, n) (*(h)->h_del)((h)->h_ref, ev, n) - -#define h_strdup(a) Strdup(a) -#define h_malloc(a) malloc(a) -#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(TYPE(History) *, TYPE(HistEvent) *, int); -private int history_getsize(TYPE(History) *, TYPE(HistEvent) *); -private int history_setunique(TYPE(History) *, TYPE(HistEvent) *, int); -private int history_getunique(TYPE(History) *, TYPE(HistEvent) *); -private int history_set_fun(TYPE(History) *, TYPE(History) *); -private int history_load(TYPE(History) *, const char *); -private int history_save(TYPE(History) *, const char *); -private int history_prev_event(TYPE(History) *, TYPE(HistEvent) *, int); -private int history_next_event(TYPE(History) *, TYPE(HistEvent) *, int); -private int history_next_string(TYPE(History) *, TYPE(HistEvent) *, const Char *); -private int history_prev_string(TYPE(History) *, TYPE(HistEvent) *, const Char *); - - -/***********************************************************************/ - -/* - * Builtin- history implementation - */ -typedef struct hentry_t { - TYPE(HistEvent) ev; /* What we return */ - void *data; /* data */ - struct hentry_t *next; /* Next entry */ - struct hentry_t *prev; /* Previous entry */ -} 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 */ - int eventid; /* For generation of unique event id */ - int flags; /* TYPE(History) flags */ -#define H_UNIQUE 1 /* Store only unique elements */ -} history_t; - -private int history_def_next(void *, TYPE(HistEvent) *); -private int history_def_first(void *, TYPE(HistEvent) *); -private int history_def_prev(void *, TYPE(HistEvent) *); -private int history_def_last(void *, TYPE(HistEvent) *); -private int history_def_curr(void *, TYPE(HistEvent) *); -private int history_def_set(void *, TYPE(HistEvent) *, const int); -private void history_def_clear(void *, TYPE(HistEvent) *); -private int history_def_enter(void *, TYPE(HistEvent) *, const Char *); -private int history_def_add(void *, TYPE(HistEvent) *, const Char *); -private int history_def_del(void *, TYPE(HistEvent) *, const int); - -private int history_def_init(void **, TYPE(HistEvent) *, int); -private int history_def_insert(history_t *, TYPE(HistEvent) *, const Char *); -private void history_def_delete(history_t *, TYPE(HistEvent) *, hentry_t *); - -private int history_deldata_nth(history_t *, TYPE(HistEvent) *, int, void **); -private int history_set_nth(void *, TYPE(HistEvent) *, int); - -#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) {\ - evp->num = code;\ - evp->str = he_strerror(code);\ - } - -/* error messages */ -static const Char *const he_errlist[] = { - STR("OK"), - STR("unknown error"), - STR("malloc() failed"), - STR("first event not found"), - STR("last event not found"), - STR("empty list"), - STR("no next event"), - STR("no previous event"), - STR("current event is invalid"), - STR("event not found"), - STR("can't read history from file"), - STR("can't write history"), - STR("required parameter(s) not supplied"), - STR("history size negative"), - STR("function not allowed with other history-functions-set the default"), - STR("bad parameters") -}; -/* error codes */ -#define _HE_OK 0 -#define _HE_UNKNOWN 1 -#define _HE_MALLOC_FAILED 2 -#define _HE_FIRST_NOTFOUND 3 -#define _HE_LAST_NOTFOUND 4 -#define _HE_EMPTY_LIST 5 -#define _HE_END_REACHED 6 -#define _HE_START_REACHED 7 -#define _HE_CURR_INVALID 8 -#define _HE_NOT_FOUND 9 -#define _HE_HIST_READ 10 -#define _HE_HIST_WRITE 11 -#define _HE_PARAM_MISSING 12 -#define _HE_SIZE_NEGATIVE 13 -#define _HE_NOT_ALLOWED 14 -#define _HE_BAD_PARAM 15 - -/* history_def_first(): - * Default function to return the first event in the history. - */ -private int -history_def_first(void *p, TYPE(HistEvent) *ev) -{ - history_t *h = (history_t *) p; - - h->cursor = h->list.next; - if (h->cursor != &h->list) - *ev = h->cursor->ev; - else { - he_seterrev(ev, _HE_FIRST_NOTFOUND); - return -1; - } - - return 0; -} - - -/* history_def_last(): - * Default function to return the last event in the history. - */ -private int -history_def_last(void *p, TYPE(HistEvent) *ev) -{ - history_t *h = (history_t *) p; - - h->cursor = h->list.prev; - if (h->cursor != &h->list) - *ev = h->cursor->ev; - else { - he_seterrev(ev, _HE_LAST_NOTFOUND); - return -1; - } - - return 0; -} - - -/* history_def_next(): - * Default function to return the next event in the history. - */ -private int -history_def_next(void *p, TYPE(HistEvent) *ev) -{ - history_t *h = (history_t *) p; - - if (h->cursor == &h->list) { - he_seterrev(ev, _HE_EMPTY_LIST); - return -1; - } - - if (h->cursor->next == &h->list) { - he_seterrev(ev, _HE_END_REACHED); - return -1; - } - - h->cursor = h->cursor->next; - *ev = h->cursor->ev; - - return 0; -} - - -/* history_def_prev(): - * Default function to return the previous event in the history. - */ -private int -history_def_prev(void *p, TYPE(HistEvent) *ev) -{ - history_t *h = (history_t *) p; - - if (h->cursor == &h->list) { - he_seterrev(ev, - (h->cur > 0) ? _HE_END_REACHED : _HE_EMPTY_LIST); - return -1; - } - - if (h->cursor->prev == &h->list) { - he_seterrev(ev, _HE_START_REACHED); - return -1; - } - - h->cursor = h->cursor->prev; - *ev = h->cursor->ev; - - return 0; -} - - -/* history_def_curr(): - * Default function to return the current event in the history. - */ -private int -history_def_curr(void *p, TYPE(HistEvent) *ev) -{ - history_t *h = (history_t *) p; - - if (h->cursor != &h->list) - *ev = h->cursor->ev; - else { - he_seterrev(ev, - (h->cur > 0) ? _HE_CURR_INVALID : _HE_EMPTY_LIST); - return -1; - } - - return 0; -} - - -/* history_def_set(): - * Default function to set the current event in the history to the - * given one. - */ -private int -history_def_set(void *p, TYPE(HistEvent) *ev, const int n) -{ - history_t *h = (history_t *) p; - - if (h->cur == 0) { - he_seterrev(ev, _HE_EMPTY_LIST); - return -1; - } - if (h->cursor == &h->list || h->cursor->ev.num != n) { - for (h->cursor = h->list.next; h->cursor != &h->list; - h->cursor = h->cursor->next) - if (h->cursor->ev.num == n) - break; - } - if (h->cursor == &h->list) { - he_seterrev(ev, _HE_NOT_FOUND); - return -1; - } - return 0; -} - - -/* history_set_nth(): - * Default function to set the current event in the history to the - * n-th one. - */ -private int -history_set_nth(void *p, TYPE(HistEvent) *ev, int n) -{ - history_t *h = (history_t *) p; - - if (h->cur == 0) { - he_seterrev(ev, _HE_EMPTY_LIST); - return -1; - } - for (h->cursor = h->list.prev; h->cursor != &h->list; - h->cursor = h->cursor->prev) - if (n-- <= 0) - break; - if (h->cursor == &h->list) { - he_seterrev(ev, _HE_NOT_FOUND); - return -1; - } - return 0; -} - - -/* history_def_add(): - * Append string to element - */ -private int -history_def_add(void *p, TYPE(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(evp->str) + Strlen(str) + 1; - s = h_malloc(len * sizeof(*s)); - if (s == NULL) { - he_seterrev(ev, _HE_MALLOC_FAILED); - return -1; - } - (void) Strncpy(s, h->cursor->ev.str, len); - s[len - 1] = '\0'; - (void) Strncat(s, str, len - Strlen(s) - 1); - h_free(evp->str); - evp->str = s; - *ev = h->cursor->ev; - return 0; -} - - -private int -history_deldata_nth(history_t *h, TYPE(HistEvent) *ev, - int num, void **data) -{ - if (history_set_nth(h, ev, num) != 0) - return -1; - /* magic value to skip delete (just set to n-th history) */ - if (data == (void **)-1) - return 0; - ev->str = Strdup(h->cursor->ev.str); - ev->num = h->cursor->ev.num; - if (data) - *data = h->cursor->data; - history_def_delete(h, ev, h->cursor); - return 0; -} - - -/* history_def_del(): - * Delete element hp of the h list - */ -/* ARGSUSED */ -private int -history_def_del(void *p, TYPE(HistEvent) *ev __attribute__((__unused__)), - const int num) -{ - history_t *h = (history_t *) p; - if (history_def_set(h, ev, num) != 0) - return -1; - ev->str = Strdup(h->cursor->ev.str); - ev->num = h->cursor->ev.num; - history_def_delete(h, ev, h->cursor); - return 0; -} - - -/* history_def_delete(): - * Delete element hp of the h list - */ -/* ARGSUSED */ -private void -history_def_delete(history_t *h, - TYPE(HistEvent) *ev __attribute__((__unused__)), hentry_t *hp) -{ - HistEventPrivate *evp = (void *)&hp->ev; - if (hp == &h->list) - abort(); - if (h->cursor == hp) { - h->cursor = hp->prev; - if (h->cursor == &h->list) - h->cursor = hp->next; - } - hp->prev->next = hp->next; - hp->next->prev = hp->prev; - h_free(evp->str); - h_free(hp); - h->cur--; -} - - -/* history_def_insert(): - * Insert element with string str in the h list - */ -private int -history_def_insert(history_t *h, TYPE(HistEvent) *ev, const Char *str) -{ - hentry_t *c; - - c = h_malloc(sizeof(*c)); - if (c == NULL) - goto oomem; - if ((c->ev.str = h_strdup(str)) == NULL) { - h_free(c); - goto oomem; - } - c->data = NULL; - c->ev.num = ++h->eventid; - c->next = h->list.next; - c->prev = &h->list; - h->list.next->prev = c; - h->list.next = c; - h->cur++; - h->cursor = c; - - *ev = c->ev; - return 0; -oomem: - he_seterrev(ev, _HE_MALLOC_FAILED); - return -1; -} - - -/* history_def_enter(): - * Default function to enter an item in the history - */ -private int -history_def_enter(void *p, TYPE(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 */ - - /* - * Always keep at least one entry. - * This way we don't have to check for the empty list. - */ - while (h->cur > h->max && h->cur > 0) - history_def_delete(h, ev, h->list.prev); - - return 1; -} - - -/* history_def_init(): - * Default history initialization function - */ -/* ARGSUSED */ -private int -history_def_init(void **p, TYPE(HistEvent) *ev __attribute__((__unused__)), int n) -{ - history_t *h = (history_t *) h_malloc(sizeof(*h)); - if (h == NULL) - return -1; - - if (n <= 0) - n = 0; - h->eventid = 0; - h->cur = 0; - h->max = n; - h->list.next = h->list.prev = &h->list; - h->list.ev.str = NULL; - h->list.ev.num = 0; - h->cursor = &h->list; - h->flags = 0; - *p = h; - return 0; -} - - -/* history_def_clear(): - * Default history cleanup function - */ -private void -history_def_clear(void *p, TYPE(HistEvent) *ev) -{ - history_t *h = (history_t *) p; - - while (h->list.prev != &h->list) - history_def_delete(h, ev, h->list.prev); - h->cursor = &h->list; - h->eventid = 0; - h->cur = 0; -} - - - - -/************************************************************************/ - -/* history_init(): - * Initialization function. - */ -public TYPE(History) * -FUN(history,init)(void) -{ - TYPE(HistEvent) ev; - TYPE(History) *h = (TYPE(History) *) h_malloc(sizeof(*h)); - if (h == NULL) - return NULL; - - if (history_def_init(&h->h_ref, &ev, 0) == -1) { - h_free(h); - return NULL; - } - h->h_ent = -1; - h->h_next = history_def_next; - h->h_first = history_def_first; - h->h_last = history_def_last; - h->h_prev = history_def_prev; - h->h_curr = history_def_curr; - h->h_set = history_def_set; - h->h_clear = history_def_clear; - h->h_enter = history_def_enter; - h->h_add = history_def_add; - h->h_del = history_def_del; - - return h; -} - - -/* history_end(): - * clean up history; - */ -public void -FUN(history,end)(TYPE(History) *h) -{ - TYPE(HistEvent) ev; - - if (h->h_next == history_def_next) - history_def_clear(h->h_ref, &ev); - h_free(h->h_ref); - h_free(h); -} - - - -/* history_setsize(): - * Set history number of events - */ -private int -history_setsize(TYPE(History) *h, TYPE(HistEvent) *ev, int num) -{ - - if (h->h_next != history_def_next) { - he_seterrev(ev, _HE_NOT_ALLOWED); - return -1; - } - if (num < 0) { - he_seterrev(ev, _HE_BAD_PARAM); - return -1; - } - history_def_setsize(h->h_ref, num); - return 0; -} - - -/* history_getsize(): - * Get number of events currently in history - */ -private int -history_getsize(TYPE(History) *h, TYPE(HistEvent) *ev) -{ - 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(TYPE(History) *h, TYPE(HistEvent) *ev, int uni) -{ - - if (h->h_next != history_def_next) { - he_seterrev(ev, _HE_NOT_ALLOWED); - return -1; - } - 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(TYPE(History) *h, TYPE(HistEvent) *ev) -{ - if (h->h_next != history_def_next) { - he_seterrev(ev, _HE_NOT_ALLOWED); - return -1; - } - ev->num = history_def_getunique(h->h_ref); - return 0; -} - - -/* history_set_fun(): - * Set history functions - */ -private int -history_set_fun(TYPE(History) *h, TYPE(History) *nh) -{ - TYPE(HistEvent) ev; - - if (nh->h_first == NULL || nh->h_next == NULL || nh->h_last == NULL || - nh->h_prev == NULL || nh->h_curr == NULL || nh->h_set == NULL || - nh->h_enter == NULL || nh->h_add == NULL || nh->h_clear == NULL || - nh->h_del == NULL || nh->h_ref == NULL) { - if (h->h_next != history_def_next) { - history_def_init(&h->h_ref, &ev, 0); - h->h_first = history_def_first; - h->h_next = history_def_next; - h->h_last = history_def_last; - h->h_prev = history_def_prev; - h->h_curr = history_def_curr; - h->h_set = history_def_set; - h->h_clear = history_def_clear; - h->h_enter = history_def_enter; - h->h_add = history_def_add; - h->h_del = history_def_del; - } - return -1; - } - if (h->h_next == history_def_next) - history_def_clear(h->h_ref, &ev); - - h->h_ent = -1; - h->h_first = nh->h_first; - h->h_next = nh->h_next; - h->h_last = nh->h_last; - h->h_prev = nh->h_prev; - h->h_curr = nh->h_curr; - h->h_set = nh->h_set; - h->h_clear = nh->h_clear; - h->h_enter = nh->h_enter; - h->h_add = nh->h_add; - h->h_del = nh->h_del; - - return 0; -} - - -/* history_load(): - * TYPE(History) load function - */ -private int -history_load(TYPE(History) *h, const char *fname) -{ - FILE *fp; - char *line; - size_t sz, max_size; - char *ptr; - int i = -1; - TYPE(HistEvent) ev; -#ifdef WIDECHAR - static ct_buffer_t conv; -#endif - - 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) * sizeof(*ptr)); - if (ptr == NULL) - goto done; - for (i = 0; (line = fgetln(fp, &sz)) != NULL; i++) { - char c = line[sz]; - - if (sz != 0 && line[sz - 1] == '\n') - line[--sz] = '\0'; - else - line[sz] = '\0'; - - if (max_size < sz) { - char *nptr; - max_size = (sz + 1024) & (size_t)~1023; - nptr = h_realloc(ptr, max_size * sizeof(*ptr)); - if (nptr == NULL) { - i = -1; - goto oomem; - } - ptr = nptr; - } - (void) strunvis(ptr, line); - line[sz] = c; - if (HENTER(h, &ev, ct_decode_string(ptr, &conv)) == -1) { - i = -1; - goto oomem; - } - } -oomem: - h_free(ptr); -done: - (void) fclose(fp); - return i; -} - - -/* history_save(): - * TYPE(History) save function - */ -private int -history_save(TYPE(History) *h, const char *fname) -{ - FILE *fp; - TYPE(HistEvent) ev; - int i = -1, retval; - size_t len, max_size; - char *ptr; - const char *str; -#ifdef WIDECHAR - static ct_buffer_t conv; -#endif - - if ((fp = fopen(fname, "w")) == NULL) - return -1; - - if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1) - goto done; - if (fputs(hist_cookie, fp) == EOF) - goto done; - ptr = h_malloc((max_size = 1024) * sizeof(*ptr)); - if (ptr == NULL) - goto done; - for (i = 0, retval = HLAST(h, &ev); - retval != -1; - retval = HPREV(h, &ev), i++) { - str = ct_encode_string(ev.str, &conv); - len = strlen(str) * 4; - if (len >= max_size) { - char *nptr; - max_size = (len + 1024) & (size_t)~1023; - nptr = h_realloc(ptr, max_size * sizeof(*ptr)); - if (nptr == NULL) { - i = -1; - goto oomem; - } - ptr = nptr; - } - (void) strvis(ptr, str, VIS_WHITE); - (void) fprintf(fp, "%s\n", ptr); - } -oomem: - h_free(ptr); -done: - (void) fclose(fp); - return i; -} - - -/* history_prev_event(): - * Find the previous event, with number given - */ -private int -history_prev_event(TYPE(History) *h, TYPE(HistEvent) *ev, int num) -{ - int retval; - - for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) - if (ev->num == num) - return 0; - - he_seterrev(ev, _HE_NOT_FOUND); - return -1; -} - - -private int -history_next_evdata(TYPE(History) *h, TYPE(HistEvent) *ev, int num, void **d) -{ - int retval; - - for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) - if (ev->num == num) { - if (d) - *d = ((history_t *)h->h_ref)->cursor->data; - return 0; - } - - he_seterrev(ev, _HE_NOT_FOUND); - return -1; -} - - -/* history_next_event(): - * Find the next event, with number given - */ -private int -history_next_event(TYPE(History) *h, TYPE(HistEvent) *ev, int num) -{ - int retval; - - for (retval = HCURR(h, ev); retval != -1; retval = HNEXT(h, ev)) - if (ev->num == num) - return 0; - - he_seterrev(ev, _HE_NOT_FOUND); - return -1; -} - - -/* history_prev_string(): - * Find the previous event beginning with string - */ -private int -history_prev_string(TYPE(History) *h, TYPE(HistEvent) *ev, const Char *str) -{ - size_t len = Strlen(str); - int retval; - - for (retval = HCURR(h, ev); retval != -1; retval = HNEXT(h, ev)) - if (Strncmp(str, ev->str, len) == 0) - return 0; - - he_seterrev(ev, _HE_NOT_FOUND); - return -1; -} - - -/* history_next_string(): - * Find the next event beginning with string - */ -private int -history_next_string(TYPE(History) *h, TYPE(HistEvent) *ev, const Char *str) -{ - size_t len = Strlen(str); - int retval; - - for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) - if (Strncmp(str, ev->str, len) == 0) - return 0; - - he_seterrev(ev, _HE_NOT_FOUND); - return -1; -} - - -/* history(): - * User interface to history functions. - */ -int -FUNW(history)(TYPE(History) *h, TYPE(HistEvent) *ev, int fun, ...) -{ - va_list va; - const Char *str; - int retval; - - va_start(va, fun); - - he_seterrev(ev, _HE_OK); - - switch (fun) { - case H_GETSIZE: - retval = history_getsize(h, ev); - break; - - case H_SETSIZE: - 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); - break; - - case H_DEL: - retval = HDEL(h, ev, va_arg(va, const int)); - break; - - case H_ENTER: - str = va_arg(va, const Char *); - if ((retval = HENTER(h, ev, str)) != -1) - h->h_ent = ev->num; - break; - - case H_APPEND: - str = va_arg(va, const Char *); - if ((retval = HSET(h, ev, h->h_ent)) != -1) - retval = HADD(h, ev, str); - break; - - case H_FIRST: - retval = HFIRST(h, ev); - break; - - case H_NEXT: - retval = HNEXT(h, ev); - break; - - case H_LAST: - retval = HLAST(h, ev); - break; - - case H_PREV: - retval = HPREV(h, ev); - break; - - case H_CURR: - retval = HCURR(h, ev); - break; - - case H_SET: - retval = HSET(h, ev, va_arg(va, const int)); - break; - - case H_CLEAR: - HCLEAR(h, ev); - retval = 0; - break; - - case H_LOAD: - retval = history_load(h, va_arg(va, const char *)); - if (retval == -1) - he_seterrev(ev, _HE_HIST_READ); - break; - - case H_SAVE: - retval = history_save(h, va_arg(va, const char *)); - if (retval == -1) - he_seterrev(ev, _HE_HIST_WRITE); - break; - - case H_PREV_EVENT: - retval = history_prev_event(h, ev, va_arg(va, int)); - break; - - case H_NEXT_EVENT: - retval = history_next_event(h, ev, va_arg(va, int)); - break; - - case H_PREV_STR: - retval = history_prev_string(h, ev, va_arg(va, const Char *)); - break; - - case H_NEXT_STR: - retval = history_next_string(h, ev, va_arg(va, const Char *)); - break; - - case H_FUNC: - { - TYPE(History) hf; - - hf.h_ref = va_arg(va, void *); - h->h_ent = -1; - hf.h_first = va_arg(va, history_gfun_t); - hf.h_next = va_arg(va, history_gfun_t); - hf.h_last = va_arg(va, history_gfun_t); - hf.h_prev = va_arg(va, history_gfun_t); - hf.h_curr = va_arg(va, history_gfun_t); - hf.h_set = va_arg(va, history_sfun_t); - hf.h_clear = va_arg(va, history_vfun_t); - hf.h_enter = va_arg(va, history_efun_t); - hf.h_add = va_arg(va, history_efun_t); - hf.h_del = va_arg(va, history_sfun_t); - - if ((retval = history_set_fun(h, &hf)) == -1) - he_seterrev(ev, _HE_PARAM_MISSING); - break; - } - - case H_END: - FUN(history,end)(h); - retval = 0; - break; - - case H_NEXT_EVDATA: - { - int num = va_arg(va, int); - void **d = va_arg(va, void **); - retval = history_next_evdata(h, ev, num, d); - break; - } - - case H_DELDATA: - { - int num = va_arg(va, int); - void **d = va_arg(va, void **); - retval = history_deldata_nth((history_t *)h->h_ref, ev, num, d); - break; - } - - case H_REPLACE: /* only use after H_NEXT_EVDATA */ - { - const Char *line = va_arg(va, const Char *); - void *d = va_arg(va, void *); - const Char *s; - if(!line || !(s = Strdup(line))) { - retval = -1; - break; - } - ((history_t *)h->h_ref)->cursor->ev.str = s; - ((history_t *)h->h_ref)->cursor->data = d; - retval = 0; - break; - } - - default: - retval = -1; - he_seterrev(ev, _HE_UNKNOWN); - break; - } - va_end(va); - return retval; -} diff --git a/cmd-line-utils/libedit/historyn.c b/cmd-line-utils/libedit/historyn.c deleted file mode 100644 index 99871ea2075..00000000000 --- a/cmd-line-utils/libedit/historyn.c +++ /dev/null @@ -1,5 +0,0 @@ -#define NARROW_WRAPPER -#include "config.h" -#undef WIDECHAR -#define NARROWCHAR -#include "./history.c" diff --git a/cmd-line-utils/libedit/keymacro.c b/cmd-line-utils/libedit/keymacro.c deleted file mode 100644 index 8df60e85d6c..00000000000 --- a/cmd-line-utils/libedit/keymacro.c +++ /dev/null @@ -1,677 +0,0 @@ -/* $NetBSD: keymacro.c,v 1.7 2011/08/16 16:25:15 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * keymacro.c: This module contains the procedures for maintaining - * the extended-key map. - * - * An extended-key (key) is a sequence of keystrokes introduced - * with a sequence introducer and consisting of an arbitrary - * number of characters. This module maintains a map (the - * el->el_keymacro.map) - * to convert these extended-key sequences into input strs - * (XK_STR), editor functions (XK_CMD), or unix commands (XK_EXE). - * - * Warning: - * If key is a substr of some other keys, then the longer - * keys are lost!! That is, if the keys "abcd" and "abcef" - * are in el->el_keymacro.map, adding the key "abc" will cause - * the first two definitions to be lost. - * - * Restrictions: - * ------------- - * 1) It is not possible to have one key that is a - * substr of another. - */ -#include -#include - -#include "el.h" - -/* - * The Nodes of the el->el_keymacro.map. The el->el_keymacro.map is a - * linked list of these node elements - */ -struct keymacro_node_t { - Char ch; /* single character of key */ - int type; /* node type */ - keymacro_value_t val; /* command code or pointer to str, */ - /* if this is a leaf */ - struct keymacro_node_t *next; /* ptr to next char of this key */ - struct keymacro_node_t *sibling;/* ptr to another key with same prefix*/ -}; - -private int node_trav(EditLine *, keymacro_node_t *, Char *, - keymacro_value_t *); -private int node__try(EditLine *, keymacro_node_t *, const Char *, - keymacro_value_t *, int); -private keymacro_node_t *node__get(Int); -private void node__free(keymacro_node_t *); -private void node__put(EditLine *, keymacro_node_t *); -private int node__delete(EditLine *, keymacro_node_t **, - const Char *); -private int node_lookup(EditLine *, const Char *, - keymacro_node_t *, size_t); -private int node_enum(EditLine *, keymacro_node_t *, size_t); - -#define KEY_BUFSIZ EL_BUFSIZ - - -/* keymacro_init(): - * Initialize the key maps - */ -protected int -keymacro_init(EditLine *el) -{ - - el->el_keymacro.buf = el_malloc(KEY_BUFSIZ * - sizeof(*el->el_keymacro.buf)); - if (el->el_keymacro.buf == NULL) - return -1; - el->el_keymacro.map = NULL; - keymacro_reset(el); - return 0; -} - -/* keymacro_end(): - * Free the key maps - */ -protected void -keymacro_end(EditLine *el) -{ - - el_free(el->el_keymacro.buf); - el->el_keymacro.buf = NULL; - node__free(el->el_keymacro.map); -} - - -/* keymacro_map_cmd(): - * Associate cmd with a key value - */ -protected keymacro_value_t * -keymacro_map_cmd(EditLine *el, int cmd) -{ - - el->el_keymacro.val.cmd = (el_action_t) cmd; - return &el->el_keymacro.val; -} - - -/* keymacro_map_str(): - * Associate str with a key value - */ -protected keymacro_value_t * -keymacro_map_str(EditLine *el, Char *str) -{ - - el->el_keymacro.val.str = str; - return &el->el_keymacro.val; -} - - -/* keymacro_reset(): - * Takes all nodes on el->el_keymacro.map and puts them on free list. - * Then initializes el->el_keymacro.map with arrow keys - * [Always bind the ansi arrow keys?] - */ -protected void -keymacro_reset(EditLine *el) -{ - - node__put(el, el->el_keymacro.map); - el->el_keymacro.map = NULL; - return; -} - - -/* keymacro_get(): - * Calls the recursive function with entry point el->el_keymacro.map - * Looks up *ch in map and then reads characters until a - * complete match is found or a mismatch occurs. Returns the - * type of the match found (XK_STR, XK_CMD, or XK_EXE). - * Returns NULL in val.str and XK_STR for no match. - * The last character read is returned in *ch. - */ -protected int -keymacro_get(EditLine *el, Char *ch, keymacro_value_t *val) -{ - - return node_trav(el, el->el_keymacro.map, ch, val); -} - - -/* keymacro_add(): - * Adds key to the el->el_keymacro.map and associates the value in - * val with it. If key is already is in el->el_keymacro.map, the new - * code is applied to the existing key. Ntype specifies if code is a - * command, an out str or a unix command. - */ -protected void -keymacro_add(EditLine *el, const Char *key, keymacro_value_t *val, int ntype) -{ - - if (key[0] == '\0') { - (void) fprintf(el->el_errfile, - "keymacro_add: Null extended-key not allowed.\n"); - return; - } - if (ntype == XK_CMD && val->cmd == ED_SEQUENCE_LEAD_IN) { - (void) fprintf(el->el_errfile, - "keymacro_add: sequence-lead-in command not allowed\n"); - return; - } - if (el->el_keymacro.map == NULL) - /* tree is initially empty. Set up new node to match key[0] */ - el->el_keymacro.map = node__get(key[0]); - /* it is properly initialized */ - - /* Now recurse through el->el_keymacro.map */ - (void) node__try(el, el->el_keymacro.map, key, val, ntype); - return; -} - - -/* keymacro_clear(): - * - */ -protected void -keymacro_clear(EditLine *el, el_action_t *map, const Char *in) -{ -#ifdef WIDECHAR - if (*in > N_KEYS) /* can't be in the map */ - return; -#endif - if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) && - ((map == el->el_map.key && - 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) keymacro_delete(el, in); -} - - -/* keymacro_delete(): - * Delete the key and all longer keys staring with key, if - * they exists. - */ -protected int -keymacro_delete(EditLine *el, const Char *key) -{ - - if (key[0] == '\0') { - (void) fprintf(el->el_errfile, - "keymacro_delete: Null extended-key not allowed.\n"); - return -1; - } - if (el->el_keymacro.map == NULL) - return 0; - - (void) node__delete(el, &el->el_keymacro.map, key); - return 0; -} - - -/* keymacro_print(): - * Print the binding associated with key key. - * Print entire el->el_keymacro.map if null - */ -protected void -keymacro_print(EditLine *el, const Char *key) -{ - - /* do nothing if el->el_keymacro.map is empty and null key specified */ - if (el->el_keymacro.map == NULL && *key == 0) - return; - - el->el_keymacro.buf[0] = '"'; - if (node_lookup(el, key, el->el_keymacro.map, (size_t)1) <= -1) - /* key is not bound */ - (void) fprintf(el->el_errfile, "Unbound extended key \"" FSTR - "\"\n", key); - return; -} - - -/* node_trav(): - * recursively traverses node in tree until match or mismatch is - * found. May read in more characters. - */ -private int -node_trav(EditLine *el, keymacro_node_t *ptr, Char *ch, keymacro_value_t *val) -{ - - if (ptr->ch == *ch) { - /* match found */ - if (ptr->next) { - /* key not complete so get next char */ - if (FUN(el,getc)(el, ch) != 1) {/* if EOF or error */ - val->cmd = ED_END_OF_FILE; - return XK_CMD; - /* PWP: Pretend we just read an end-of-file */ - } - return node_trav(el, ptr->next, ch, val); - } else { - *val = ptr->val; - if (ptr->type != XK_CMD) - *ch = '\0'; - return ptr->type; - } - } else { - /* no match found here */ - if (ptr->sibling) { - /* try next sibling */ - return node_trav(el, ptr->sibling, ch, val); - } else { - /* no next sibling -- mismatch */ - val->str = NULL; - return XK_STR; - } - } -} - - -/* node__try(): - * Find a node that matches *str or allocate a new one - */ -private int -node__try(EditLine *el, keymacro_node_t *ptr, const Char *str, - keymacro_value_t *val, int ntype) -{ - - if (ptr->ch != *str) { - keymacro_node_t *xm; - - for (xm = ptr; xm->sibling != NULL; xm = xm->sibling) - if (xm->sibling->ch == *str) - break; - if (xm->sibling == NULL) - xm->sibling = node__get(*str); /* setup new node */ - ptr = xm->sibling; - } - if (*++str == '\0') { - /* we're there */ - if (ptr->next != NULL) { - node__put(el, ptr->next); - /* lose longer keys with this prefix */ - ptr->next = NULL; - } - switch (ptr->type) { - case XK_CMD: - case XK_NOD: - break; - case XK_STR: - case XK_EXE: - if (ptr->val.str) - el_free(ptr->val.str); - break; - default: - EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", - ptr->type)); - break; - } - - switch (ptr->type = ntype) { - case XK_CMD: - ptr->val = *val; - break; - case XK_STR: - case XK_EXE: - if ((ptr->val.str = Strdup(val->str)) == NULL) - return -1; - break; - default: - EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype)); - break; - } - } else { - /* still more chars to go */ - if (ptr->next == NULL) - ptr->next = node__get(*str); /* setup new node */ - (void) node__try(el, ptr->next, str, val, ntype); - } - return 0; -} - - -/* node__delete(): - * Delete node that matches str - */ -private int -node__delete(EditLine *el, keymacro_node_t **inptr, const Char *str) -{ - keymacro_node_t *ptr; - keymacro_node_t *prev_ptr = NULL; - - ptr = *inptr; - - if (ptr->ch != *str) { - keymacro_node_t *xm; - - for (xm = ptr; xm->sibling != NULL; xm = xm->sibling) - if (xm->sibling->ch == *str) - break; - if (xm->sibling == NULL) - return 0; - prev_ptr = xm; - ptr = xm->sibling; - } - if (*++str == '\0') { - /* we're there */ - if (prev_ptr == NULL) - *inptr = ptr->sibling; - else - prev_ptr->sibling = ptr->sibling; - ptr->sibling = NULL; - node__put(el, ptr); - return 1; - } else if (ptr->next != NULL && - node__delete(el, &ptr->next, str) == 1) { - if (ptr->next != NULL) - return 0; - if (prev_ptr == NULL) - *inptr = ptr->sibling; - else - prev_ptr->sibling = ptr->sibling; - ptr->sibling = NULL; - node__put(el, ptr); - return 1; - } else { - return 0; - } -} - - -/* node__put(): - * Puts a tree of nodes onto free list using free(3). - */ -private void -node__put(EditLine *el, keymacro_node_t *ptr) -{ - if (ptr == NULL) - return; - - if (ptr->next != NULL) { - node__put(el, ptr->next); - ptr->next = NULL; - } - node__put(el, ptr->sibling); - - switch (ptr->type) { - case XK_CMD: - case XK_NOD: - break; - case XK_EXE: - case XK_STR: - if (ptr->val.str != NULL) - el_free(ptr->val.str); - break; - default: - EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ptr->type)); - break; - } - el_free(ptr); -} - - -/* node__get(): - * Returns pointer to a keymacro_node_t for ch. - */ -private keymacro_node_t * -node__get(Int ch) -{ - keymacro_node_t *ptr; - - ptr = el_malloc(sizeof(*ptr)); - if (ptr == NULL) - return NULL; - ptr->ch = ch; - ptr->type = XK_NOD; - ptr->val.str = NULL; - ptr->next = NULL; - ptr->sibling = NULL; - return ptr; -} - -private void -node__free(keymacro_node_t *k) -{ - if (k == NULL) - return; - node__free(k->sibling); - node__free(k->next); - el_free(k); -} - -/* node_lookup(): - * look for the str starting at node ptr. - * Print if last node - */ -private int -node_lookup(EditLine *el, const Char *str, keymacro_node_t *ptr, size_t cnt) -{ - ssize_t used; - - if (ptr == NULL) - return -1; /* cannot have null ptr */ - - if (!str || *str == 0) { - /* no more chars in str. node_enum from here. */ - (void) node_enum(el, ptr, cnt); - return 0; - } else { - /* If match put this char into el->el_keymacro.buf. Recurse */ - if (ptr->ch == *str) { - /* match found */ - used = ct_visual_char(el->el_keymacro.buf + cnt, - KEY_BUFSIZ - cnt, ptr->ch); - if (used == -1) - return -1; /* ran out of buffer space */ - if (ptr->next != NULL) - /* not yet at leaf */ - return (node_lookup(el, str + 1, ptr->next, - (size_t)used + cnt)); - else { - /* next node is null so key should be complete */ - if (str[1] == 0) { - size_t px = cnt + (size_t)used; - el->el_keymacro.buf[px] = '"'; - el->el_keymacro.buf[px + 1] = '\0'; - keymacro_kprint(el, el->el_keymacro.buf, - &ptr->val, ptr->type); - return 0; - } else - return -1; - /* mismatch -- str still has chars */ - } - } else { - /* no match found try sibling */ - if (ptr->sibling) - return (node_lookup(el, str, ptr->sibling, - cnt)); - else - return -1; - } - } -} - - -/* node_enum(): - * Traverse the node printing the characters it is bound in buffer - */ -private int -node_enum(EditLine *el, keymacro_node_t *ptr, size_t cnt) -{ - ssize_t used; - - if (cnt >= KEY_BUFSIZ - 5) { /* buffer too small */ - el->el_keymacro.buf[++cnt] = '"'; - el->el_keymacro.buf[++cnt] = '\0'; - (void) fprintf(el->el_errfile, - "Some extended keys too long for internal print buffer"); - (void) fprintf(el->el_errfile, " \"" FSTR "...\"\n", - el->el_keymacro.buf); - return 0; - } - if (ptr == NULL) { -#ifdef DEBUG_EDIT - (void) fprintf(el->el_errfile, - "node_enum: BUG!! Null ptr passed\n!"); -#endif - return -1; - } - /* put this char at end of str */ - used = ct_visual_char(el->el_keymacro.buf + cnt, KEY_BUFSIZ - cnt, - ptr->ch); - if (ptr->next == NULL) { - /* print this key and function */ - el->el_keymacro.buf[cnt + (size_t)used ] = '"'; - el->el_keymacro.buf[cnt + (size_t)used + 1] = '\0'; - keymacro_kprint(el, el->el_keymacro.buf, &ptr->val, ptr->type); - } else - (void) node_enum(el, ptr->next, cnt + (size_t)used); - - /* go to sibling if there is one */ - if (ptr->sibling) - (void) node_enum(el, ptr->sibling, cnt); - return 0; -} - - -/* keymacro_kprint(): - * Print the specified key and its associated - * function specified by val - */ -protected void -keymacro_kprint(EditLine *el, const Char *key, keymacro_value_t *val, int ntype) -{ - el_bindings_t *fp; - char unparsbuf[EL_BUFSIZ]; - static const char fmt[] = "%-15s-> %s\n"; - mbstate_t state; - - memset(&state, 0, sizeof(mbstate_t)); - if (val != NULL) - switch (ntype) { - case XK_STR: - case XK_EXE: - (void) keymacro__decode_str(val->str, unparsbuf, - sizeof(unparsbuf), - ntype == XK_STR ? "\"\"" : "[]"); - (void) fprintf(el->el_outfile, fmt, - ct_encode_string(key, &el->el_scratch), unparsbuf); - break; - case XK_CMD: - for (fp = el->el_map.help; fp->name; fp++) - if (val->cmd == fp->func) { - memset(&state, 0, sizeof(mbstate_t)); - wcsrtombs(unparsbuf, (const wchar_t **) &fp->name, - sizeof(unparsbuf), &state); - unparsbuf[sizeof(unparsbuf) -1] = '\0'; - (void) fprintf(el->el_outfile, fmt, - ct_encode_string(key, &el->el_scratch), unparsbuf); - break; - } -#ifdef DEBUG_KEY - if (fp->name == NULL) - (void) fprintf(el->el_outfile, - "BUG! Command not found.\n"); -#endif - - break; - default: - EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype)); - break; - } - else - (void) fprintf(el->el_outfile, fmt, ct_encode_string(key, - &el->el_scratch), "no input"); -} - - -#define ADDC(c) \ - if (b < eb) \ - *b++ = c; \ - else \ - b++ -/* keymacro__decode_str(): - * Make a printable version of the ey - */ -protected size_t -keymacro__decode_str(const Char *str, char *buf, size_t len, const char *sep) -{ - char *b = buf, *eb = b + len; - const Char *p; - mbstate_t state; - - memset(&state, 0, sizeof(mbstate_t)); - b = buf; - if (sep[0] != '\0') { - ADDC(sep[0]); - } - if (*str == '\0') { - ADDC('^'); - ADDC('@'); - goto add_endsep; - } - for (p = str; *p != 0; p++) { - Char dbuf[VISUAL_WIDTH_MAX]; - Char *p2 = dbuf; - ssize_t l = ct_visual_char(dbuf, VISUAL_WIDTH_MAX, *p); - while (l-- > 0) { - ssize_t n = ct_encode_char(b, (size_t)(eb - b), *p2++, - &state); - if (n == -1) /* ran out of space */ - goto add_endsep; - else - b += n; - } - } -add_endsep: - if (sep[0] != '\0' && sep[1] != '\0') { - ADDC(sep[1]); - } - ADDC('\0'); - if ((size_t)(b - buf) >= len) - buf[len - 1] = '\0'; - return (size_t)(b - buf); -} diff --git a/cmd-line-utils/libedit/keymacro.h b/cmd-line-utils/libedit/keymacro.h deleted file mode 100644 index 2445de5a5bc..00000000000 --- a/cmd-line-utils/libedit/keymacro.h +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: keymacro.h,v 1.2 2011/07/28 03:44:36 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)key.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.keymacro.h: Key macro header - */ -#ifndef _h_el_keymacro -#define _h_el_keymacro - -typedef union keymacro_value_t { - el_action_t cmd; /* If it is a command the # */ - Char *str; /* If it is a string... */ -} keymacro_value_t; - -typedef struct keymacro_node_t keymacro_node_t; - -typedef struct el_keymacromacro_t { - Char *buf; /* Key print buffer */ - keymacro_node_t *map; /* Key map */ - keymacro_value_t val; /* Local conversion buffer */ -} el_keymacro_t; - -#define XK_CMD 0 -#define XK_STR 1 -#define XK_NOD 2 -#define XK_EXE 3 - -protected int keymacro_init(EditLine *); -protected void keymacro_end(EditLine *); -protected keymacro_value_t *keymacro_map_cmd(EditLine *, int); -protected keymacro_value_t *keymacro_map_str(EditLine *, Char *); -protected void keymacro_reset(EditLine *); -protected int keymacro_get(EditLine *, Char *, keymacro_value_t *); -protected void keymacro_add(EditLine *, const Char *, keymacro_value_t *, int); -protected void keymacro_clear(EditLine *, el_action_t *, const Char *); -protected int keymacro_delete(EditLine *, const Char *); -protected void keymacro_print(EditLine *, const Char *); -protected void keymacro_kprint(EditLine *, const Char *, keymacro_value_t *, - int); -protected size_t keymacro__decode_str(const Char *, char *, size_t, - const char *); - -#endif /* _h_el_keymacro */ diff --git a/cmd-line-utils/libedit/makelist.sh b/cmd-line-utils/libedit/makelist.sh deleted file mode 100644 index b1a28c32370..00000000000 --- a/cmd-line-utils/libedit/makelist.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/sh - -# $NetBSD: makelist,v 1.16 2010/04/18 21:17:05 christos Exp $ -# -# Copyright (c) 1992, 1993 -# The Regents of the University of California. All rights reserved. -# -# This code is derived from software contributed to Berkeley by -# Christos Zoulas of Cornell University. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# @(#)makelist 5.3 (Berkeley) 6/4/93 - -# makelist.sh: Automatically generate header files... - -AWK=@AWK@ -USAGE="Usage: $0 -n|-h|-e|-fc|-fh|-bc|-bh|-m " - -if [ "x$1" = "x" ] -then - echo $USAGE 1>&2 - exit 1 -fi - -FLAG="$1" -shift - -FILES="$@" - -case $FLAG in - -# generate foo.h file from foo.c -# --n) - cat << _EOF -#undef WIDECHAR -#define NARROWCHAR -#include "${FILES}" -_EOF - ;; - --h) - set - `echo $FILES | sed -e 's/\\./_/g'` - hdr="_h_`basename $1`" - cat $FILES | $AWK ' - BEGIN { - printf("/* Automatically generated file, do not edit */\n"); - printf("#ifndef %s\n#define %s\n", "'$hdr'", "'$hdr'"); - } - /\(\):/ { - pr = substr($2, 1, 2); - if (pr == "vi" || pr == "em" || pr == "ed") { - # XXXMYSQL: support CRLF - name = substr($2, 1, index($2,"(") - 1); -# -# XXX: need a space between name and prototype so that -fc and -fh -# parsing is much easier -# - printf("protected el_action_t\t%s (EditLine *, Int);\n", name); - } - } - END { - printf("#endif /* %s */\n", "'$hdr'"); - }' - ;; - -# generate help.c from various .c files -# --bc) - cat $FILES | $AWK ' - BEGIN { - printf("/* Automatically generated file, do not edit */\n"); - printf("#include \"config.h\"\n#include \"el.h\"\n"); - printf("#include \"chartype.h\"\n"); - printf("private const struct el_bindings_t el_func_help[] = {\n"); - low = "abcdefghijklmnopqrstuvwxyz_"; - high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"; - for (i = 1; i <= length(low); i++) - tr[substr(low, i, 1)] = substr(high, i, 1); - } - /\(\):/ { - pr = substr($2, 1, 2); - if (pr == "vi" || pr == "em" || pr == "ed") { - # XXXMYSQL: support CRLF - name = substr($2, 1, index($2,"(") - 1); - uname = ""; - fname = ""; - for (i = 1; i <= length(name); i++) { - s = substr(name, i, 1); - uname = uname tr[s]; - if (s == "_") - s = "-"; - fname = fname s; - } - - printf(" { %-30.30s %-30.30s\n","STR(\"" fname "\"),", uname ","); - ok = 1; - } - } - /^ \*/ { - if (ok) { - printf(" STR(\""); - for (i = 2; i < NF; i++) - printf("%s ", $i); - # XXXMYSQL: support CRLF - sub("\r", "", $i); - printf("%s\") },\n", $i); - ok = 0; - } - } - END { - printf("};\n"); - printf("\nprotected const el_bindings_t* help__get()"); - printf("{ return el_func_help; }\n"); - }' - ;; - -# generate help.h from various .c files -# --bh) - $AWK ' - BEGIN { - printf("/* Automatically generated file, do not edit */\n"); - printf("#ifndef _h_help_c\n#define _h_help_c\n"); - printf("protected const el_bindings_t *help__get(void);\n"); - printf("#endif /* _h_help_c */\n"); - }' /dev/null - ;; - -# generate fcns.h from various .h files -# -# XXXMYSQL: use portable tr syntax --fh) - cat $FILES | $AWK '/el_action_t/ { print $3 }' | \ - sort | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | $AWK ' - BEGIN { - printf("/* Automatically generated file, do not edit */\n"); - printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n"); - count = 0; - } - { - printf("#define\t%-30.30s\t%3d\n", $1, count++); - } - END { - printf("#define\t%-30.30s\t%3d\n", "EL_NUM_FCNS", count); - - printf("typedef el_action_t (*el_func_t)(EditLine *, Int);"); - printf("\nprotected const el_func_t* func__get(void);\n"); - printf("#endif /* _h_fcns_c */\n"); - }' - ;; - -# generate fcns.c from various .h files -# --fc) - cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK ' - BEGIN { - printf("/* Automatically generated file, do not edit */\n"); - printf("#include \"config.h\"\n#include \"el.h\"\n"); - printf("private const el_func_t el_func[] = {"); - maxlen = 80; - needn = 1; - len = 0; - } - { - clen = 25 + 2; - len += clen; - if (len >= maxlen) - needn = 1; - if (needn) { - printf("\n "); - needn = 0; - len = 4 + clen; - } - s = $1 ","; - printf("%-26.26s ", s); - } - END { - printf("\n};\n"); - printf("\nprotected const el_func_t* func__get() { return el_func; }\n"); - }' - ;; - -# generate editline.c from various .c files -# --e) - echo "$FILES" | tr ' ' '\012' | $AWK ' - BEGIN { - printf("/* Automatically generated file, do not edit */\n"); - printf("#define protected static\n"); - printf("#define SCCSID\n"); - } - { - printf("#include \"%s\"\n", $1); - }' - ;; - -# generate man page fragment from various .c files -# --m) - cat $FILES | $AWK ' - BEGIN { - printf(".\\\" Section automatically generated with makelist\n"); - printf(".Bl -tag -width 4n\n"); - } - /\(\):/ { - pr = substr($2, 1, 2); - if (pr == "vi" || pr == "em" || pr == "ed") { - # XXXMYSQL: support CRLF - name = substr($2, 1, index($2, "(") - 1); - fname = ""; - for (i = 1; i <= length(name); i++) { - s = substr(name, i, 1); - if (s == "_") - s = "-"; - fname = fname s; - } - - printf(".It Ic %s\n", fname); - ok = 1; - } - } - /^ \*/ { - if (ok) { - for (i = 2; i < NF; i++) - printf("%s ", $i); - printf("%s.\n", $i); - ok = 0; - } - } - END { - printf(".El\n"); - printf(".\\\" End of section automatically generated with makelist\n"); - }' - ;; - -*) - echo $USAGE 1>&2 - exit 1 - ;; - -esac diff --git a/cmd-line-utils/libedit/map.c b/cmd-line-utils/libedit/map.c deleted file mode 100644 index 17b07391b69..00000000000 --- a/cmd-line-utils/libedit/map.c +++ /dev/null @@ -1,1420 +0,0 @@ -/* $NetBSD: map.c,v 1.30 2011/08/16 16:25:15 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * map.c: Editor function definitions - */ -#include -#include "el.h" - -private void map_print_key(EditLine *, el_action_t *, const Char *); -private void map_print_some_keys(EditLine *, el_action_t *, Int, Int); -private void map_print_all_keys(EditLine *); -private void map_init_nls(EditLine *); -private void map_init_meta(EditLine *); - -/* keymap tables ; should be N_KEYS*sizeof(KEYCMD) bytes long */ - - -private const el_action_t el_map_emacs[] = { - /* 0 */ EM_SET_MARK, /* ^@ */ - /* 1 */ ED_MOVE_TO_BEG, /* ^A */ - /* 2 */ ED_PREV_CHAR, /* ^B */ - /* 3 */ ED_TTY_SIGINT, /* ^C */ - /* 4 */ EM_DELETE_OR_LIST, /* ^D */ - /* 5 */ ED_MOVE_TO_END, /* ^E */ - /* 6 */ ED_NEXT_CHAR, /* ^F */ - /* 7 */ ED_UNASSIGNED, /* ^G */ - /* 8 */ EM_DELETE_PREV_CHAR, /* ^H */ - /* 9 */ ED_UNASSIGNED, /* ^I */ - /* 10 */ ED_NEWLINE, /* ^J */ - /* 11 */ ED_KILL_LINE, /* ^K */ - /* 12 */ ED_CLEAR_SCREEN, /* ^L */ - /* 13 */ ED_NEWLINE, /* ^M */ - /* 14 */ ED_NEXT_HISTORY, /* ^N */ - /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */ - /* 16 */ ED_PREV_HISTORY, /* ^P */ - /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */ - /* 18 */ ED_REDISPLAY, /* ^R */ - /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */ - /* 20 */ ED_TRANSPOSE_CHARS, /* ^T */ - /* 21 */ EM_KILL_LINE, /* ^U */ - /* 22 */ ED_QUOTED_INSERT, /* ^V */ - /* 23 */ EM_KILL_REGION, /* ^W */ - /* 24 */ ED_SEQUENCE_LEAD_IN, /* ^X */ - /* 25 */ EM_YANK, /* ^Y */ - /* 26 */ ED_TTY_SIGTSTP, /* ^Z */ - /* 27 */ EM_META_NEXT, /* ^[ */ - /* 28 */ ED_TTY_SIGQUIT, /* ^\ */ - /* 29 */ ED_TTY_DSUSP, /* ^] */ - /* 30 */ ED_UNASSIGNED, /* ^^ */ - /* 31 */ ED_UNASSIGNED, /* ^_ */ - /* 32 */ ED_INSERT, /* SPACE */ - /* 33 */ ED_INSERT, /* ! */ - /* 34 */ ED_INSERT, /* " */ - /* 35 */ ED_INSERT, /* # */ - /* 36 */ ED_INSERT, /* $ */ - /* 37 */ ED_INSERT, /* % */ - /* 38 */ ED_INSERT, /* & */ - /* 39 */ ED_INSERT, /* ' */ - /* 40 */ ED_INSERT, /* ( */ - /* 41 */ ED_INSERT, /* ) */ - /* 42 */ ED_INSERT, /* * */ - /* 43 */ ED_INSERT, /* + */ - /* 44 */ ED_INSERT, /* , */ - /* 45 */ ED_INSERT, /* - */ - /* 46 */ ED_INSERT, /* . */ - /* 47 */ ED_INSERT, /* / */ - /* 48 */ ED_DIGIT, /* 0 */ - /* 49 */ ED_DIGIT, /* 1 */ - /* 50 */ ED_DIGIT, /* 2 */ - /* 51 */ ED_DIGIT, /* 3 */ - /* 52 */ ED_DIGIT, /* 4 */ - /* 53 */ ED_DIGIT, /* 5 */ - /* 54 */ ED_DIGIT, /* 6 */ - /* 55 */ ED_DIGIT, /* 7 */ - /* 56 */ ED_DIGIT, /* 8 */ - /* 57 */ ED_DIGIT, /* 9 */ - /* 58 */ ED_INSERT, /* : */ - /* 59 */ ED_INSERT, /* ; */ - /* 60 */ ED_INSERT, /* < */ - /* 61 */ ED_INSERT, /* = */ - /* 62 */ ED_INSERT, /* > */ - /* 63 */ ED_INSERT, /* ? */ - /* 64 */ ED_INSERT, /* @ */ - /* 65 */ ED_INSERT, /* A */ - /* 66 */ ED_INSERT, /* B */ - /* 67 */ ED_INSERT, /* C */ - /* 68 */ ED_INSERT, /* D */ - /* 69 */ ED_INSERT, /* E */ - /* 70 */ ED_INSERT, /* F */ - /* 71 */ ED_INSERT, /* G */ - /* 72 */ ED_INSERT, /* H */ - /* 73 */ ED_INSERT, /* I */ - /* 74 */ ED_INSERT, /* J */ - /* 75 */ ED_INSERT, /* K */ - /* 76 */ ED_INSERT, /* L */ - /* 77 */ ED_INSERT, /* M */ - /* 78 */ ED_INSERT, /* N */ - /* 79 */ ED_INSERT, /* O */ - /* 80 */ ED_INSERT, /* P */ - /* 81 */ ED_INSERT, /* Q */ - /* 82 */ ED_INSERT, /* R */ - /* 83 */ ED_INSERT, /* S */ - /* 84 */ ED_INSERT, /* T */ - /* 85 */ ED_INSERT, /* U */ - /* 86 */ ED_INSERT, /* V */ - /* 87 */ ED_INSERT, /* W */ - /* 88 */ ED_INSERT, /* X */ - /* 89 */ ED_INSERT, /* Y */ - /* 90 */ ED_INSERT, /* Z */ - /* 91 */ ED_INSERT, /* [ */ - /* 92 */ ED_INSERT, /* \ */ - /* 93 */ ED_INSERT, /* ] */ - /* 94 */ ED_INSERT, /* ^ */ - /* 95 */ ED_INSERT, /* _ */ - /* 96 */ ED_INSERT, /* ` */ - /* 97 */ ED_INSERT, /* a */ - /* 98 */ ED_INSERT, /* b */ - /* 99 */ ED_INSERT, /* c */ - /* 100 */ ED_INSERT, /* d */ - /* 101 */ ED_INSERT, /* e */ - /* 102 */ ED_INSERT, /* f */ - /* 103 */ ED_INSERT, /* g */ - /* 104 */ ED_INSERT, /* h */ - /* 105 */ ED_INSERT, /* i */ - /* 106 */ ED_INSERT, /* j */ - /* 107 */ ED_INSERT, /* k */ - /* 108 */ ED_INSERT, /* l */ - /* 109 */ ED_INSERT, /* m */ - /* 110 */ ED_INSERT, /* n */ - /* 111 */ ED_INSERT, /* o */ - /* 112 */ ED_INSERT, /* p */ - /* 113 */ ED_INSERT, /* q */ - /* 114 */ ED_INSERT, /* r */ - /* 115 */ ED_INSERT, /* s */ - /* 116 */ ED_INSERT, /* t */ - /* 117 */ ED_INSERT, /* u */ - /* 118 */ ED_INSERT, /* v */ - /* 119 */ ED_INSERT, /* w */ - /* 120 */ ED_INSERT, /* x */ - /* 121 */ ED_INSERT, /* y */ - /* 122 */ ED_INSERT, /* z */ - /* 123 */ ED_INSERT, /* { */ - /* 124 */ ED_INSERT, /* | */ - /* 125 */ ED_INSERT, /* } */ - /* 126 */ ED_INSERT, /* ~ */ - /* 127 */ EM_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_DELETE_PREV_WORD, /* M-^H */ - /* 137 */ ED_UNASSIGNED, /* M-^I */ - /* 138 */ ED_UNASSIGNED, /* M-^J */ - /* 139 */ ED_UNASSIGNED, /* M-^K */ - /* 140 */ ED_CLEAR_SCREEN, /* 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 */ EM_COPY_PREV_WORD, /* 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_ARGUMENT_DIGIT, /* M-0 */ - /* 177 */ ED_ARGUMENT_DIGIT, /* M-1 */ - /* 178 */ ED_ARGUMENT_DIGIT, /* M-2 */ - /* 179 */ ED_ARGUMENT_DIGIT, /* M-3 */ - /* 180 */ ED_ARGUMENT_DIGIT, /* M-4 */ - /* 181 */ ED_ARGUMENT_DIGIT, /* M-5 */ - /* 182 */ ED_ARGUMENT_DIGIT, /* M-6 */ - /* 183 */ ED_ARGUMENT_DIGIT, /* M-7 */ - /* 184 */ ED_ARGUMENT_DIGIT, /* M-8 */ - /* 185 */ ED_ARGUMENT_DIGIT, /* 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_PREV_WORD, /* M-B */ - /* 195 */ EM_CAPITOL_CASE, /* M-C */ - /* 196 */ EM_DELETE_NEXT_WORD, /* M-D */ - /* 197 */ ED_UNASSIGNED, /* M-E */ - /* 198 */ EM_NEXT_WORD, /* 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 */ EM_LOWER_CASE, /* M-L */ - /* 205 */ ED_UNASSIGNED, /* M-M */ - /* 206 */ ED_SEARCH_NEXT_HISTORY, /* M-N */ - /* 207 */ ED_SEQUENCE_LEAD_IN, /* M-O */ - /* 208 */ ED_SEARCH_PREV_HISTORY, /* M-P */ - /* 209 */ ED_UNASSIGNED, /* M-Q */ - /* 210 */ ED_UNASSIGNED, /* M-R */ - /* 211 */ ED_UNASSIGNED, /* M-S */ - /* 212 */ ED_UNASSIGNED, /* M-T */ - /* 213 */ EM_UPPER_CASE, /* M-U */ - /* 214 */ ED_UNASSIGNED, /* M-V */ - /* 215 */ EM_COPY_REGION, /* M-W */ - /* 216 */ ED_COMMAND, /* M-X */ - /* 217 */ ED_UNASSIGNED, /* M-Y */ - /* 218 */ ED_UNASSIGNED, /* M-Z */ - /* 219 */ ED_SEQUENCE_LEAD_IN, /* M-[ */ - /* 220 */ ED_UNASSIGNED, /* M-\ */ - /* 221 */ ED_UNASSIGNED, /* M-] */ - /* 222 */ ED_UNASSIGNED, /* M-^ */ - /* 223 */ ED_UNASSIGNED, /* M-_ */ - /* 223 */ ED_UNASSIGNED, /* M-` */ - /* 224 */ ED_UNASSIGNED, /* M-a */ - /* 225 */ ED_PREV_WORD, /* M-b */ - /* 226 */ EM_CAPITOL_CASE, /* M-c */ - /* 227 */ EM_DELETE_NEXT_WORD, /* M-d */ - /* 228 */ ED_UNASSIGNED, /* M-e */ - /* 229 */ EM_NEXT_WORD, /* M-f */ - /* 230 */ ED_UNASSIGNED, /* M-g */ - /* 231 */ ED_UNASSIGNED, /* M-h */ - /* 232 */ ED_UNASSIGNED, /* M-i */ - /* 233 */ ED_UNASSIGNED, /* M-j */ - /* 234 */ ED_UNASSIGNED, /* M-k */ - /* 235 */ EM_LOWER_CASE, /* M-l */ - /* 236 */ ED_UNASSIGNED, /* M-m */ - /* 237 */ ED_SEARCH_NEXT_HISTORY, /* M-n */ - /* 238 */ ED_UNASSIGNED, /* M-o */ - /* 239 */ ED_SEARCH_PREV_HISTORY, /* M-p */ - /* 240 */ ED_UNASSIGNED, /* M-q */ - /* 241 */ ED_UNASSIGNED, /* M-r */ - /* 242 */ ED_UNASSIGNED, /* M-s */ - /* 243 */ ED_UNASSIGNED, /* M-t */ - /* 244 */ EM_UPPER_CASE, /* M-u */ - /* 245 */ ED_UNASSIGNED, /* M-v */ - /* 246 */ EM_COPY_REGION, /* M-w */ - /* 247 */ ED_COMMAND, /* M-x */ - /* 248 */ ED_UNASSIGNED, /* M-y */ - /* 249 */ ED_UNASSIGNED, /* M-z */ - /* 250 */ ED_UNASSIGNED, /* M-{ */ - /* 251 */ ED_UNASSIGNED, /* M-| */ - /* 252 */ ED_UNASSIGNED, /* M-} */ - /* 253 */ ED_UNASSIGNED, /* M-~ */ - /* 254 */ ED_DELETE_PREV_WORD /* M-^? */ - /* 255 */ -}; - - -/* - * keymap table for vi. Each index into above tbl; should be - * N_KEYS entries long. Vi mode uses a sticky-extend to do command mode: - * insert mode characters are in the normal keymap, and command mode - * in the extended keymap. - */ -private const el_action_t el_map_vi_insert[] = { -#ifdef KSHVI - /* 0 */ ED_UNASSIGNED, /* ^@ */ - /* 1 */ ED_INSERT, /* ^A */ - /* 2 */ ED_INSERT, /* ^B */ - /* 3 */ ED_INSERT, /* ^C */ - /* 4 */ VI_LIST_OR_EOF, /* ^D */ - /* 5 */ ED_INSERT, /* ^E */ - /* 6 */ ED_INSERT, /* ^F */ - /* 7 */ ED_INSERT, /* ^G */ - /* 8 */ VI_DELETE_PREV_CHAR, /* ^H */ /* BackSpace key */ - /* 9 */ ED_INSERT, /* ^I */ /* Tab Key */ - /* 10 */ ED_NEWLINE, /* ^J */ - /* 11 */ ED_INSERT, /* ^K */ - /* 12 */ ED_INSERT, /* ^L */ - /* 13 */ ED_NEWLINE, /* ^M */ - /* 14 */ ED_INSERT, /* ^N */ - /* 15 */ ED_INSERT, /* ^O */ - /* 16 */ ED_INSERT, /* ^P */ - /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */ - /* 18 */ ED_INSERT, /* ^R */ - /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */ - /* 20 */ ED_INSERT, /* ^T */ - /* 21 */ VI_KILL_LINE_PREV, /* ^U */ - /* 22 */ ED_QUOTED_INSERT, /* ^V */ - /* 23 */ ED_DELETE_PREV_WORD, /* ^W */ - /* ED_DELETE_PREV_WORD: Only until strt edit pos */ - /* 24 */ ED_INSERT, /* ^X */ - /* 25 */ ED_INSERT, /* ^Y */ - /* 26 */ ED_INSERT, /* ^Z */ - /* 27 */ VI_COMMAND_MODE, /* ^[ */ /* [ Esc ] key */ - /* 28 */ ED_TTY_SIGQUIT, /* ^\ */ - /* 29 */ ED_INSERT, /* ^] */ - /* 30 */ ED_INSERT, /* ^^ */ - /* 31 */ ED_INSERT, /* ^_ */ -#else /* !KSHVI */ - /* - * NOTE: These mappings do NOT Correspond well - * to the KSH VI editing assignments. - * On the other and they are convenient and - * many people have have gotten used to them. - */ - /* 0 */ ED_UNASSIGNED, /* ^@ */ - /* 1 */ ED_MOVE_TO_BEG, /* ^A */ - /* 2 */ ED_PREV_CHAR, /* ^B */ - /* 3 */ ED_TTY_SIGINT, /* ^C */ - /* 4 */ VI_LIST_OR_EOF, /* ^D */ - /* 5 */ ED_MOVE_TO_END, /* ^E */ - /* 6 */ ED_NEXT_CHAR, /* ^F */ - /* 7 */ ED_UNASSIGNED, /* ^G */ - /* 8 */ VI_DELETE_PREV_CHAR, /* ^H */ /* BackSpace key */ - /* 9 */ ED_UNASSIGNED, /* ^I */ /* Tab Key */ - /* 10 */ ED_NEWLINE, /* ^J */ - /* 11 */ ED_KILL_LINE, /* ^K */ - /* 12 */ ED_CLEAR_SCREEN, /* ^L */ - /* 13 */ ED_NEWLINE, /* ^M */ - /* 14 */ ED_NEXT_HISTORY, /* ^N */ - /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */ - /* 16 */ ED_PREV_HISTORY, /* ^P */ - /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */ - /* 18 */ ED_REDISPLAY, /* ^R */ - /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */ - /* 20 */ ED_TRANSPOSE_CHARS, /* ^T */ - /* 21 */ VI_KILL_LINE_PREV, /* ^U */ - /* 22 */ ED_QUOTED_INSERT, /* ^V */ - /* 23 */ ED_DELETE_PREV_WORD, /* ^W */ - /* 24 */ ED_UNASSIGNED, /* ^X */ - /* 25 */ ED_TTY_DSUSP, /* ^Y */ - /* 26 */ ED_TTY_SIGTSTP, /* ^Z */ - /* 27 */ VI_COMMAND_MODE, /* ^[ */ - /* 28 */ ED_TTY_SIGQUIT, /* ^\ */ - /* 29 */ ED_UNASSIGNED, /* ^] */ - /* 30 */ ED_UNASSIGNED, /* ^^ */ - /* 31 */ ED_UNASSIGNED, /* ^_ */ -#endif /* KSHVI */ - /* 32 */ ED_INSERT, /* SPACE */ - /* 33 */ ED_INSERT, /* ! */ - /* 34 */ ED_INSERT, /* " */ - /* 35 */ ED_INSERT, /* # */ - /* 36 */ ED_INSERT, /* $ */ - /* 37 */ ED_INSERT, /* % */ - /* 38 */ ED_INSERT, /* & */ - /* 39 */ ED_INSERT, /* ' */ - /* 40 */ ED_INSERT, /* ( */ - /* 41 */ ED_INSERT, /* ) */ - /* 42 */ ED_INSERT, /* * */ - /* 43 */ ED_INSERT, /* + */ - /* 44 */ ED_INSERT, /* , */ - /* 45 */ ED_INSERT, /* - */ - /* 46 */ ED_INSERT, /* . */ - /* 47 */ ED_INSERT, /* / */ - /* 48 */ ED_INSERT, /* 0 */ - /* 49 */ ED_INSERT, /* 1 */ - /* 50 */ ED_INSERT, /* 2 */ - /* 51 */ ED_INSERT, /* 3 */ - /* 52 */ ED_INSERT, /* 4 */ - /* 53 */ ED_INSERT, /* 5 */ - /* 54 */ ED_INSERT, /* 6 */ - /* 55 */ ED_INSERT, /* 7 */ - /* 56 */ ED_INSERT, /* 8 */ - /* 57 */ ED_INSERT, /* 9 */ - /* 58 */ ED_INSERT, /* : */ - /* 59 */ ED_INSERT, /* ; */ - /* 60 */ ED_INSERT, /* < */ - /* 61 */ ED_INSERT, /* = */ - /* 62 */ ED_INSERT, /* > */ - /* 63 */ ED_INSERT, /* ? */ - /* 64 */ ED_INSERT, /* @ */ - /* 65 */ ED_INSERT, /* A */ - /* 66 */ ED_INSERT, /* B */ - /* 67 */ ED_INSERT, /* C */ - /* 68 */ ED_INSERT, /* D */ - /* 69 */ ED_INSERT, /* E */ - /* 70 */ ED_INSERT, /* F */ - /* 71 */ ED_INSERT, /* G */ - /* 72 */ ED_INSERT, /* H */ - /* 73 */ ED_INSERT, /* I */ - /* 74 */ ED_INSERT, /* J */ - /* 75 */ ED_INSERT, /* K */ - /* 76 */ ED_INSERT, /* L */ - /* 77 */ ED_INSERT, /* M */ - /* 78 */ ED_INSERT, /* N */ - /* 79 */ ED_INSERT, /* O */ - /* 80 */ ED_INSERT, /* P */ - /* 81 */ ED_INSERT, /* Q */ - /* 82 */ ED_INSERT, /* R */ - /* 83 */ ED_INSERT, /* S */ - /* 84 */ ED_INSERT, /* T */ - /* 85 */ ED_INSERT, /* U */ - /* 86 */ ED_INSERT, /* V */ - /* 87 */ ED_INSERT, /* W */ - /* 88 */ ED_INSERT, /* X */ - /* 89 */ ED_INSERT, /* Y */ - /* 90 */ ED_INSERT, /* Z */ - /* 91 */ ED_INSERT, /* [ */ - /* 92 */ ED_INSERT, /* \ */ - /* 93 */ ED_INSERT, /* ] */ - /* 94 */ ED_INSERT, /* ^ */ - /* 95 */ ED_INSERT, /* _ */ - /* 96 */ ED_INSERT, /* ` */ - /* 97 */ ED_INSERT, /* a */ - /* 98 */ ED_INSERT, /* b */ - /* 99 */ ED_INSERT, /* c */ - /* 100 */ ED_INSERT, /* d */ - /* 101 */ ED_INSERT, /* e */ - /* 102 */ ED_INSERT, /* f */ - /* 103 */ ED_INSERT, /* g */ - /* 104 */ ED_INSERT, /* h */ - /* 105 */ ED_INSERT, /* i */ - /* 106 */ ED_INSERT, /* j */ - /* 107 */ ED_INSERT, /* k */ - /* 108 */ ED_INSERT, /* l */ - /* 109 */ ED_INSERT, /* m */ - /* 110 */ ED_INSERT, /* n */ - /* 111 */ ED_INSERT, /* o */ - /* 112 */ ED_INSERT, /* p */ - /* 113 */ ED_INSERT, /* q */ - /* 114 */ ED_INSERT, /* r */ - /* 115 */ ED_INSERT, /* s */ - /* 116 */ ED_INSERT, /* t */ - /* 117 */ ED_INSERT, /* u */ - /* 118 */ ED_INSERT, /* v */ - /* 119 */ ED_INSERT, /* w */ - /* 120 */ ED_INSERT, /* x */ - /* 121 */ ED_INSERT, /* y */ - /* 122 */ ED_INSERT, /* z */ - /* 123 */ ED_INSERT, /* { */ - /* 124 */ ED_INSERT, /* | */ - /* 125 */ ED_INSERT, /* } */ - /* 126 */ ED_INSERT, /* ~ */ - /* 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[] = { - /* 0 */ ED_UNASSIGNED, /* ^@ */ - /* 1 */ ED_MOVE_TO_BEG, /* ^A */ - /* 2 */ ED_UNASSIGNED, /* ^B */ - /* 3 */ ED_TTY_SIGINT, /* ^C */ - /* 4 */ ED_UNASSIGNED, /* ^D */ - /* 5 */ ED_MOVE_TO_END, /* ^E */ - /* 6 */ ED_UNASSIGNED, /* ^F */ - /* 7 */ ED_UNASSIGNED, /* ^G */ - /* 8 */ ED_DELETE_PREV_CHAR, /* ^H */ - /* 9 */ ED_UNASSIGNED, /* ^I */ - /* 10 */ ED_NEWLINE, /* ^J */ - /* 11 */ ED_KILL_LINE, /* ^K */ - /* 12 */ ED_CLEAR_SCREEN, /* ^L */ - /* 13 */ ED_NEWLINE, /* ^M */ - /* 14 */ ED_NEXT_HISTORY, /* ^N */ - /* 15 */ ED_TTY_FLUSH_OUTPUT, /* ^O */ - /* 16 */ ED_PREV_HISTORY, /* ^P */ - /* 17 */ ED_TTY_START_OUTPUT, /* ^Q */ - /* 18 */ ED_REDISPLAY, /* ^R */ - /* 19 */ ED_TTY_STOP_OUTPUT, /* ^S */ - /* 20 */ ED_UNASSIGNED, /* ^T */ - /* 21 */ VI_KILL_LINE_PREV, /* ^U */ - /* 22 */ ED_UNASSIGNED, /* ^V */ - /* 23 */ ED_DELETE_PREV_WORD, /* ^W */ - /* 24 */ ED_UNASSIGNED, /* ^X */ - /* 25 */ ED_UNASSIGNED, /* ^Y */ - /* 26 */ ED_UNASSIGNED, /* ^Z */ - /* 27 */ EM_META_NEXT, /* ^[ */ - /* 28 */ ED_TTY_SIGQUIT, /* ^\ */ - /* 29 */ ED_UNASSIGNED, /* ^] */ - /* 30 */ ED_UNASSIGNED, /* ^^ */ - /* 31 */ ED_UNASSIGNED, /* ^_ */ - /* 32 */ ED_NEXT_CHAR, /* SPACE */ - /* 33 */ ED_UNASSIGNED, /* ! */ - /* 34 */ ED_UNASSIGNED, /* " */ - /* 35 */ VI_COMMENT_OUT, /* # */ - /* 36 */ ED_MOVE_TO_END, /* $ */ - /* 37 */ VI_MATCH, /* % */ - /* 38 */ ED_UNASSIGNED, /* & */ - /* 39 */ ED_UNASSIGNED, /* ' */ - /* 40 */ ED_UNASSIGNED, /* ( */ - /* 41 */ ED_UNASSIGNED, /* ) */ - /* 42 */ ED_UNASSIGNED, /* * */ - /* 43 */ ED_NEXT_HISTORY, /* + */ - /* 44 */ VI_REPEAT_PREV_CHAR, /* , */ - /* 45 */ ED_PREV_HISTORY, /* - */ - /* 46 */ VI_REDO, /* . */ - /* 47 */ VI_SEARCH_PREV, /* / */ - /* 48 */ VI_ZERO, /* 0 */ - /* 49 */ ED_ARGUMENT_DIGIT, /* 1 */ - /* 50 */ ED_ARGUMENT_DIGIT, /* 2 */ - /* 51 */ ED_ARGUMENT_DIGIT, /* 3 */ - /* 52 */ ED_ARGUMENT_DIGIT, /* 4 */ - /* 53 */ ED_ARGUMENT_DIGIT, /* 5 */ - /* 54 */ ED_ARGUMENT_DIGIT, /* 6 */ - /* 55 */ ED_ARGUMENT_DIGIT, /* 7 */ - /* 56 */ ED_ARGUMENT_DIGIT, /* 8 */ - /* 57 */ ED_ARGUMENT_DIGIT, /* 9 */ - /* 58 */ ED_COMMAND, /* : */ - /* 59 */ VI_REPEAT_NEXT_CHAR, /* ; */ - /* 60 */ ED_UNASSIGNED, /* < */ - /* 61 */ ED_UNASSIGNED, /* = */ - /* 62 */ ED_UNASSIGNED, /* > */ - /* 63 */ VI_SEARCH_NEXT, /* ? */ - /* 64 */ VI_ALIAS, /* @ */ - /* 65 */ VI_ADD_AT_EOL, /* A */ - /* 66 */ VI_PREV_BIG_WORD, /* B */ - /* 67 */ VI_CHANGE_TO_EOL, /* C */ - /* 68 */ ED_KILL_LINE, /* D */ - /* 69 */ VI_END_BIG_WORD, /* E */ - /* 70 */ VI_PREV_CHAR, /* F */ - /* 71 */ VI_TO_HISTORY_LINE, /* G */ - /* 72 */ ED_UNASSIGNED, /* H */ - /* 73 */ VI_INSERT_AT_BOL, /* I */ - /* 74 */ ED_SEARCH_NEXT_HISTORY, /* J */ - /* 75 */ ED_SEARCH_PREV_HISTORY, /* K */ - /* 76 */ ED_UNASSIGNED, /* L */ - /* 77 */ ED_UNASSIGNED, /* M */ - /* 78 */ VI_REPEAT_SEARCH_PREV, /* N */ - /* 79 */ ED_SEQUENCE_LEAD_IN, /* O */ - /* 80 */ VI_PASTE_PREV, /* P */ - /* 81 */ ED_UNASSIGNED, /* Q */ - /* 82 */ VI_REPLACE_MODE, /* R */ - /* 83 */ VI_SUBSTITUTE_LINE, /* S */ - /* 84 */ VI_TO_PREV_CHAR, /* T */ - /* 85 */ VI_UNDO_LINE, /* U */ - /* 86 */ ED_UNASSIGNED, /* V */ - /* 87 */ VI_NEXT_BIG_WORD, /* W */ - /* 88 */ ED_DELETE_PREV_CHAR, /* X */ - /* 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 */ VI_HISTORY_WORD, /* _ */ - /* 96 */ ED_UNASSIGNED, /* ` */ - /* 97 */ VI_ADD, /* a */ - /* 98 */ VI_PREV_WORD, /* b */ - /* 99 */ VI_CHANGE_META, /* c */ - /* 100 */ VI_DELETE_META, /* d */ - /* 101 */ VI_END_WORD, /* e */ - /* 102 */ VI_NEXT_CHAR, /* f */ - /* 103 */ ED_UNASSIGNED, /* g */ - /* 104 */ ED_PREV_CHAR, /* h */ - /* 105 */ VI_INSERT, /* i */ - /* 106 */ ED_NEXT_HISTORY, /* j */ - /* 107 */ ED_PREV_HISTORY, /* k */ - /* 108 */ ED_NEXT_CHAR, /* l */ - /* 109 */ ED_UNASSIGNED, /* m */ - /* 110 */ VI_REPEAT_SEARCH_NEXT, /* n */ - /* 111 */ ED_UNASSIGNED, /* o */ - /* 112 */ VI_PASTE_NEXT, /* p */ - /* 113 */ ED_UNASSIGNED, /* q */ - /* 114 */ VI_REPLACE_CHAR, /* r */ - /* 115 */ VI_SUBSTITUTE_CHAR, /* s */ - /* 116 */ VI_TO_NEXT_CHAR, /* t */ - /* 117 */ VI_UNDO, /* u */ - /* 118 */ VI_HISTEDIT, /* v */ - /* 119 */ VI_NEXT_WORD, /* w */ - /* 120 */ ED_DELETE_NEXT_CHAR, /* x */ - /* 121 */ VI_YANK, /* y */ - /* 122 */ ED_UNASSIGNED, /* z */ - /* 123 */ ED_UNASSIGNED, /* { */ - /* 124 */ VI_TO_COLUMN, /* | */ - /* 125 */ ED_UNASSIGNED, /* } */ - /* 126 */ VI_CHANGE_CASE, /* ~ */ - /* 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_SEQUENCE_LEAD_IN, /* 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_SEQUENCE_LEAD_IN, /* 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-^? */ -}; - - -/* map_init(): - * Initialize and allocate the maps - */ -protected int -map_init(EditLine *el) -{ - - /* - * Make sure those are correct before starting. - */ -#ifdef MAP_DEBUG - if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Emacs map incorrect\n")); - if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Vi command map incorrect\n")); - if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t)) - EL_ABORT((el->errfile, "Vi insert map incorrect\n")); -#endif - - el->el_map.alt = el_malloc(sizeof(*el->el_map.alt) * N_KEYS); - if (el->el_map.alt == NULL) - return -1; - el->el_map.key = el_malloc(sizeof(*el->el_map.key) * N_KEYS); - if (el->el_map.key == NULL) - return -1; - el->el_map.emacs = el_map_emacs; - el->el_map.vic = el_map_vi_command; - el->el_map.vii = el_map_vi_insert; - el->el_map.help = el_malloc(sizeof(*el->el_map.help) * EL_NUM_FCNS); - if (el->el_map.help == NULL) - return -1; - (void) memcpy(el->el_map.help, help__get(), - sizeof(*el->el_map.help) * EL_NUM_FCNS); - el->el_map.func = el_malloc(sizeof(*el->el_map.func) * EL_NUM_FCNS); - if (el->el_map.func == NULL) - return -1; - memcpy(el->el_map.func, func__get(), sizeof(*el->el_map.func) - * EL_NUM_FCNS); - el->el_map.nfunc = EL_NUM_FCNS; - -#ifdef VIDEFAULT - map_init_vi(el); -#else - map_init_emacs(el); -#endif /* VIDEFAULT */ - return 0; -} - - -/* map_end(): - * Free the space taken by the editor maps - */ -protected void -map_end(EditLine *el) -{ - - el_free(el->el_map.alt); - el->el_map.alt = NULL; - el_free(el->el_map.key); - el->el_map.key = NULL; - el->el_map.emacs = NULL; - el->el_map.vic = NULL; - el->el_map.vii = NULL; - el_free(el->el_map.help); - el->el_map.help = NULL; - el_free(el->el_map.func); - el->el_map.func = NULL; -} - - -/* map_init_nls(): - * Find all the printable keys and bind them to self insert - */ -private void -map_init_nls(EditLine *el) -{ - int i; - - el_action_t *map = el->el_map.key; - - for (i = 0200; i <= 0377; i++) - if (Isprint(i)) - map[i] = ED_INSERT; -} - - -/* map_init_meta(): - * Bind all the meta keys to the appropriate ESC- sequence - */ -private void -map_init_meta(EditLine *el) -{ - Char buf[3]; - int i; - el_action_t *map = el->el_map.key; - el_action_t *alt = el->el_map.alt; - - for (i = 0; i <= 0377 && map[i] != EM_META_NEXT; i++) - continue; - - if (i > 0377) { - for (i = 0; i <= 0377 && alt[i] != EM_META_NEXT; i++) - continue; - if (i > 0377) { - i = 033; - if (el->el_map.type == MAP_VI) - map = alt; - } else - map = alt; - } - buf[0] = (Char) i; - buf[2] = 0; - for (i = 0200; i <= 0377; i++) - switch (map[i]) { - case ED_INSERT: - case ED_UNASSIGNED: - case ED_SEQUENCE_LEAD_IN: - break; - default: - buf[1] = i & 0177; - keymacro_add(el, buf, keymacro_map_cmd(el, (int) map[i]), XK_CMD); - break; - } - map[(int) buf[0]] = ED_SEQUENCE_LEAD_IN; -} - - -/* map_init_vi(): - * Initialize the vi bindings - */ -protected void -map_init_vi(EditLine *el) -{ - int i; - el_action_t *key = el->el_map.key; - el_action_t *alt = el->el_map.alt; - const el_action_t *vii = el->el_map.vii; - const el_action_t *vic = el->el_map.vic; - - el->el_map.type = MAP_VI; - el->el_map.current = el->el_map.key; - - keymacro_reset(el); - - for (i = 0; i < N_KEYS; i++) { - key[i] = vii[i]; - alt[i] = vic[i]; - } - - map_init_meta(el); - map_init_nls(el); - - tty_bind_char(el, 1); - terminal_bind_arrow(el); -} - - -/* map_init_emacs(): - * Initialize the emacs bindings - */ -protected void -map_init_emacs(EditLine *el) -{ - int i; - Char buf[3]; - el_action_t *key = el->el_map.key; - el_action_t *alt = el->el_map.alt; - const el_action_t *emacs = el->el_map.emacs; - - el->el_map.type = MAP_EMACS; - el->el_map.current = el->el_map.key; - keymacro_reset(el); - - for (i = 0; i < N_KEYS; i++) { - key[i] = emacs[i]; - alt[i] = ED_UNASSIGNED; - } - - map_init_meta(el); - map_init_nls(el); - - buf[0] = CONTROL('X'); - buf[1] = CONTROL('X'); - buf[2] = 0; - keymacro_add(el, buf, keymacro_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD); - - tty_bind_char(el, 1); - terminal_bind_arrow(el); -} - - -/* map_set_editor(): - * Set the editor - */ -protected int -map_set_editor(EditLine *el, Char *editor) -{ - - if (Strcmp(editor, STR("emacs")) == 0) { - map_init_emacs(el); - return 0; - } - if (Strcmp(editor, STR("vi")) == 0) { - map_init_vi(el); - return 0; - } - return -1; -} - - -/* map_get_editor(): - * Retrieve the editor - */ -protected int -map_get_editor(EditLine *el, const Char **editor) -{ - - if (editor == NULL) - return -1; - switch (el->el_map.type) { - case MAP_EMACS: - *editor = STR("emacs"); - return 0; - case MAP_VI: - *editor = STR("vi"); - return 0; - } - return -1; -} - - -/* map_print_key(): - * Print the function description for 1 key - */ -private void -map_print_key(EditLine *el, el_action_t *map, const Char *in) -{ - char outbuf[EL_BUFSIZ]; - el_bindings_t *bp, *ep; - - if (in[0] == '\0' || in[1] == '\0') { - (void) keymacro__decode_str(in, outbuf, sizeof(outbuf), ""); - ep = &el->el_map.help[el->el_map.nfunc]; - for (bp = el->el_map.help; bp < ep; bp++) - if (bp->func == map[(unsigned char) *in]) { - (void) fprintf(el->el_outfile, - "%s\t->\t" FSTR "\n", outbuf, bp->name); - return; - } - } else - keymacro_print(el, in); -} - - -/* map_print_some_keys(): - * Print keys from first to last - */ -private void -map_print_some_keys(EditLine *el, el_action_t *map, Int first, Int last) -{ - el_bindings_t *bp, *ep; - Char firstbuf[2], lastbuf[2]; - char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ]; - - firstbuf[0] = first; - firstbuf[1] = 0; - lastbuf[0] = last; - lastbuf[1] = 0; - if (map[first] == ED_UNASSIGNED) { - if (first == last) { - (void) keymacro__decode_str(firstbuf, unparsbuf, - sizeof(unparsbuf), STRQQ); - (void) fprintf(el->el_outfile, - "%-15s-> is undefined\n", unparsbuf); - } - return; - } - ep = &el->el_map.help[el->el_map.nfunc]; - for (bp = el->el_map.help; bp < ep; bp++) { - if (bp->func == map[first]) { - if (first == last) { - (void) keymacro__decode_str(firstbuf, unparsbuf, - sizeof(unparsbuf), STRQQ); - (void) fprintf(el->el_outfile, "%-15s-> " FSTR "\n", - unparsbuf, bp->name); - } else { - (void) keymacro__decode_str(firstbuf, unparsbuf, - sizeof(unparsbuf), STRQQ); - (void) keymacro__decode_str(lastbuf, extrabuf, - sizeof(extrabuf), STRQQ); - (void) fprintf(el->el_outfile, - "%-4s to %-7s-> " FSTR "\n", - unparsbuf, extrabuf, bp->name); - } - return; - } - } -#ifdef MAP_DEBUG - if (map == el->el_map.key) { - (void) keymacro__decode_str(firstbuf, unparsbuf, - sizeof(unparsbuf), STRQQ); - (void) fprintf(el->el_outfile, - "BUG!!! %s isn't bound to anything.\n", unparsbuf); - (void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n", - first, el->el_map.key[first]); - } else { - (void) keymacro__decode_str(firstbuf, unparsbuf, - sizeof(unparsbuf), STRQQ); - (void) fprintf(el->el_outfile, - "BUG!!! %s isn't bound to anything.\n", unparsbuf); - (void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n", - first, el->el_map.alt[first]); - } -#endif - EL_ABORT((el->el_errfile, "Error printing keys\n")); -} - - -/* map_print_all_keys(): - * Print the function description for all keys. - */ -private void -map_print_all_keys(EditLine *el) -{ - int prev, i; - - (void) fprintf(el->el_outfile, "Standard key bindings\n"); - prev = 0; - for (i = 0; i < N_KEYS; i++) { - if (el->el_map.key[prev] == el->el_map.key[i]) - continue; - map_print_some_keys(el, el->el_map.key, prev, i - 1); - prev = i; - } - map_print_some_keys(el, el->el_map.key, prev, i - 1); - - (void) fprintf(el->el_outfile, "Alternative key bindings\n"); - prev = 0; - for (i = 0; i < N_KEYS; i++) { - if (el->el_map.alt[prev] == el->el_map.alt[i]) - continue; - map_print_some_keys(el, el->el_map.alt, prev, i - 1); - prev = i; - } - map_print_some_keys(el, el->el_map.alt, prev, i - 1); - - (void) fprintf(el->el_outfile, "Multi-character bindings\n"); - keymacro_print(el, STR("")); - (void) fprintf(el->el_outfile, "Arrow key bindings\n"); - terminal_print_arrow(el, STR("")); -} - - -/* map_bind(): - * Add/remove/change bindings - */ -protected int -map_bind(EditLine *el, int argc, const Char **argv) -{ - el_action_t *map; - int ntype, rem; - const Char *p; - Char inbuf[EL_BUFSIZ]; - Char outbuf[EL_BUFSIZ]; - const Char *in = NULL; - Char *out = NULL; - el_bindings_t *bp, *ep; - int cmd; - int key; - - if (argv == NULL) - return -1; - - map = el->el_map.key; - ntype = XK_CMD; - key = rem = 0; - for (argc = 1; (p = argv[argc]) != NULL; argc++) - if (p[0] == '-') - switch (p[1]) { - case 'a': - map = el->el_map.alt; - break; - - case 's': - ntype = XK_STR; - break; -#ifdef notyet - case 'c': - ntype = XK_EXE; - break; -#endif - case 'k': - key = 1; - break; - - case 'r': - rem = 1; - break; - - case 'v': - map_init_vi(el); - return 0; - - case 'e': - map_init_emacs(el); - return 0; - - case 'l': - ep = &el->el_map.help[el->el_map.nfunc]; - for (bp = el->el_map.help; bp < ep; bp++) - (void) fprintf(el->el_outfile, - "" FSTR "\n\t" FSTR "\n", - bp->name, bp->description); - return 0; - default: - (void) fprintf(el->el_errfile, - "" FSTR ": Invalid switch `%c'.\n", - argv[0], (int) p[1]); - } - else - break; - - if (argv[argc] == NULL) { - map_print_all_keys(el); - return 0; - } - if (key) - in = argv[argc++]; - else if ((in = parse__string(inbuf, argv[argc++])) == NULL) { - (void) fprintf(el->el_errfile, - "" FSTR ": Invalid \\ or ^ in instring.\n", - argv[0]); - return -1; - } - if (rem) { - if (key) { - (void) terminal_clear_arrow(el, in); - return -1; - } - if (in[1]) - (void) keymacro_delete(el, in); - else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) - (void) keymacro_delete(el, in); - else - map[(unsigned char) *in] = ED_UNASSIGNED; - return 0; - } - if (argv[argc] == NULL) { - if (key) - terminal_print_arrow(el, in); - else - map_print_key(el, map, in); - return 0; - } -#ifdef notyet - if (argv[argc + 1] != NULL) { - bindkeymacro_usage(); - return -1; - } -#endif - - switch (ntype) { - case XK_STR: - case XK_EXE: - if ((out = parse__string(outbuf, argv[argc])) == NULL) { - (void) fprintf(el->el_errfile, - "" FSTR ": Invalid \\ or ^ in outstring.\n", argv[0]); - return -1; - } - if (key) - terminal_set_arrow(el, in, keymacro_map_str(el, out), ntype); - else - keymacro_add(el, in, keymacro_map_str(el, out), ntype); - map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN; - break; - - case XK_CMD: - if ((cmd = parse_cmd(el, argv[argc])) == -1) { - (void) fprintf(el->el_errfile, - "" FSTR ": Invalid command `" FSTR "'.\n", - argv[0], argv[argc]); - return -1; - } - if (key) - terminal_set_arrow(el, in, keymacro_map_str(el, out), ntype); - else { - if (in[1]) { - keymacro_add(el, in, keymacro_map_cmd(el, cmd), ntype); - map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN; - } else { - keymacro_clear(el, map, in); - map[(unsigned char) *in] = (el_action_t)cmd; - } - } - break; - - default: - EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype)); - break; - } - return 0; -} - - -/* map_addfunc(): - * add a user defined function - */ -protected int -map_addfunc(EditLine *el, const Char *name, const Char *help, el_func_t func) -{ - void *p; - size_t nf = (size_t)el->el_map.nfunc + 1; - - if (name == NULL || help == NULL || func == NULL) - return -1; - - if ((p = el_realloc(el->el_map.func, nf * - sizeof(*el->el_map.func))) == NULL) - return -1; - el->el_map.func = p; - if ((p = el_realloc(el->el_map.help, nf * sizeof(*el->el_map.help))) - == NULL) - return -1; - el->el_map.help = p; - - nf = (size_t)el->el_map.nfunc; - el->el_map.func[nf] = func; - - el->el_map.help[nf].name = name; - el->el_map.help[nf].func = (int)nf; - el->el_map.help[nf].description = help; - el->el_map.nfunc++; - - return 0; -} diff --git a/cmd-line-utils/libedit/map.h b/cmd-line-utils/libedit/map.h deleted file mode 100644 index 8e0c7e4eaa1..00000000000 --- a/cmd-line-utils/libedit/map.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: map.h,v 1.9 2009/12/30 22:37:40 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)map.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.map.h: Editor maps - */ -#ifndef _h_el_map -#define _h_el_map - -typedef struct el_bindings_t { /* for the "bind" shell command */ - const Char *name; /* function name for bind command */ - int func; /* function numeric value */ - const Char *description; /* description of function */ -} el_bindings_t; - - -typedef struct el_map_t { - el_action_t *alt; /* The current alternate key map */ - el_action_t *key; /* The current normal key map */ - el_action_t *current; /* The keymap we are using */ - const el_action_t *emacs; /* The default emacs key map */ - const el_action_t *vic; /* The vi command mode key map */ - const el_action_t *vii; /* The vi insert mode key map */ - int type; /* Emacs or vi */ - el_bindings_t *help; /* The help for the editor functions */ - el_func_t *func; /* List of available functions */ - int nfunc; /* The number of functions/help items */ -} el_map_t; - -#define MAP_EMACS 0 -#define MAP_VI 1 - -#define N_KEYS 256 - -protected int map_bind(EditLine *, int, const Char **); -protected int map_init(EditLine *); -protected void map_end(EditLine *); -protected void map_init_vi(EditLine *); -protected void map_init_emacs(EditLine *); -protected int map_set_editor(EditLine *, Char *); -protected int map_get_editor(EditLine *, const Char **); -protected int map_addfunc(EditLine *, const Char *, const Char *, el_func_t); - -#endif /* _h_el_map */ diff --git a/cmd-line-utils/libedit/np/fgetln.c b/cmd-line-utils/libedit/np/fgetln.c deleted file mode 100644 index 898abc758dc..00000000000 --- a/cmd-line-utils/libedit/np/fgetln.c +++ /dev/null @@ -1,108 +0,0 @@ -/* $NetBSD: fgetln.c,v 1.9 2008/04/29 06:53:03 martin 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. - * - * 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. - */ - -#ifdef HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#else -#include "config.h" -#endif - -#if !HAVE_FGETLN -#include -#ifndef HAVE_NBTOOL_CONFIG_H -/* These headers are required, but included from nbtool_config.h */ -#include -#include -#include -#include -#endif - -char * -fgetln(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; - - if (fgets(&buf[bufsiz], BUFSIZ, fp) == NULL) { - buf[bufsiz] = '\0'; - *len = strlen(buf); - return buf; - } - - *len = bufsiz; - bufsiz = nbufsiz; - } - - *len = (ptr - buf) + 1; - return buf; -} - -#endif - -#ifdef TEST -int -main(int argc, char *argv[]) -{ - char *p; - size_t len; - - while ((p = fgetln(stdin, &len)) != NULL) { - (void)printf("%zu %s", len, p); - free(p); - } - return 0; -} -#endif diff --git a/cmd-line-utils/libedit/np/strlcat.c b/cmd-line-utils/libedit/np/strlcat.c deleted file mode 100644 index 4e2897d8f35..00000000000 --- a/cmd-line-utils/libedit/np/strlcat.c +++ /dev/null @@ -1,85 +0,0 @@ -/* $NetBSD: strlcat.c,v 1.3 2007/06/04 18:19:27 christos Exp $ */ -/* $OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE - * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#else -#include "config.h" -#endif - -#if defined(LIBC_SCCS) && !defined(lint) -#endif /* LIBC_SCCS and not lint */ - -#ifdef _LIBC -#include "namespace.h" -#endif -#include -#include -#include - -#ifdef _LIBC -# ifdef __weak_alias -__weak_alias(strlcat, _strlcat) -# endif -#endif - -#else -#include -#endif /* !_KERNEL && !_STANDALONE */ - -#if !HAVE_STRLCAT -/* - * 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(src) + MIN(siz, strlen(initial dst)). - * If retval >= siz, truncation occurred. - */ -size_t -strlcat(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz; - size_t dlen; - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - - /* 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 */ -} -#endif diff --git a/cmd-line-utils/libedit/np/strlcpy.c b/cmd-line-utils/libedit/np/strlcpy.c deleted file mode 100644 index ccbe6812dfc..00000000000 --- a/cmd-line-utils/libedit/np/strlcpy.c +++ /dev/null @@ -1,81 +0,0 @@ -/* $NetBSD: strlcpy.c,v 1.3 2007/06/04 18:19:27 christos Exp $ */ -/* $OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE - * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#else -#include "config.h" -#endif - -#if defined(LIBC_SCCS) && !defined(lint) -#endif /* LIBC_SCCS and not lint */ - -#ifdef _LIBC -#include "namespace.h" -#endif -#include -#include -#include - -#ifdef _LIBC -# ifdef __weak_alias -__weak_alias(strlcpy, _strlcpy) -# endif -#endif -#else -#include -#endif /* !_KERNEL && !_STANDALONE */ - - -#if !HAVE_STRLCPY -/* - * 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(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz; - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - - /* 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 */ -} -#endif diff --git a/cmd-line-utils/libedit/np/unvis.c b/cmd-line-utils/libedit/np/unvis.c deleted file mode 100644 index a911720ad35..00000000000 --- a/cmd-line-utils/libedit/np/unvis.c +++ /dev/null @@ -1,560 +0,0 @@ -/* $NetBSD: unvis.c,v 1.36 2011/03/18 09:07:20 martin 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. 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 -#endif -#endif /* LIBC_SCCS and not lint */ - -/* XXXMYSQL : Make compiler happy. */ -#ifdef _LIBC -#include "namespace.h" -#endif - -#include - -#include -#include - -/* XXXMYSQL : stdint.h might not be available on older Solaris platforms. */ -#if defined(__sun) || defined(__sun__) -#include -#else -#include -#endif - -#include -#include -/* - XXXMYSQL : Due to different versions of vis.h available, - use the one bundled with libedit. -*/ -#include "np/vis.h" - -#ifdef __weak_alias -__weak_alias(strnunvisx,_strnunvisx); -#endif - -#if !HAVE_VIS -/* - * 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 /* http hex digit */ -#define S_HEX2 8 /* http hex digit 2 */ -#define S_MIME1 9 /* mime hex digit 1 */ -#define S_MIME2 10 /* mime hex digit 2 */ -#define S_EATCRNL 11 /* mime eating CRNL */ -#define S_AMP 12 /* seen & */ -#define S_NUMBER 13 /* collecting number */ -#define S_STRING 14 /* collecting string */ - -#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') -#define xtod(c) (isdigit(c) ? (c - '0') : ((tolower(c) - 'a') + 10)) -#define XTOD(c) (isdigit(c) ? (c - '0') : ((c - 'A') + 10)) - -/* - * RFC 1866 - */ -static const struct nv { - const char *name; - uint8_t value; -} nv[] = { - { "AElig", 198 }, /* capital AE diphthong (ligature) */ - { "Aacute", 193 }, /* capital A, acute accent */ - { "Acirc", 194 }, /* capital A, circumflex accent */ - { "Agrave", 192 }, /* capital A, grave accent */ - { "Aring", 197 }, /* capital A, ring */ - { "Atilde", 195 }, /* capital A, tilde */ - { "Auml", 196 }, /* capital A, dieresis or umlaut mark */ - { "Ccedil", 199 }, /* capital C, cedilla */ - { "ETH", 208 }, /* capital Eth, Icelandic */ - { "Eacute", 201 }, /* capital E, acute accent */ - { "Ecirc", 202 }, /* capital E, circumflex accent */ - { "Egrave", 200 }, /* capital E, grave accent */ - { "Euml", 203 }, /* capital E, dieresis or umlaut mark */ - { "Iacute", 205 }, /* capital I, acute accent */ - { "Icirc", 206 }, /* capital I, circumflex accent */ - { "Igrave", 204 }, /* capital I, grave accent */ - { "Iuml", 207 }, /* capital I, dieresis or umlaut mark */ - { "Ntilde", 209 }, /* capital N, tilde */ - { "Oacute", 211 }, /* capital O, acute accent */ - { "Ocirc", 212 }, /* capital O, circumflex accent */ - { "Ograve", 210 }, /* capital O, grave accent */ - { "Oslash", 216 }, /* capital O, slash */ - { "Otilde", 213 }, /* capital O, tilde */ - { "Ouml", 214 }, /* capital O, dieresis or umlaut mark */ - { "THORN", 222 }, /* capital THORN, Icelandic */ - { "Uacute", 218 }, /* capital U, acute accent */ - { "Ucirc", 219 }, /* capital U, circumflex accent */ - { "Ugrave", 217 }, /* capital U, grave accent */ - { "Uuml", 220 }, /* capital U, dieresis or umlaut mark */ - { "Yacute", 221 }, /* capital Y, acute accent */ - { "aacute", 225 }, /* small a, acute accent */ - { "acirc", 226 }, /* small a, circumflex accent */ - { "acute", 180 }, /* acute accent */ - { "aelig", 230 }, /* small ae diphthong (ligature) */ - { "agrave", 224 }, /* small a, grave accent */ - { "amp", 38 }, /* ampersand */ - { "aring", 229 }, /* small a, ring */ - { "atilde", 227 }, /* small a, tilde */ - { "auml", 228 }, /* small a, dieresis or umlaut mark */ - { "brvbar", 166 }, /* broken (vertical) bar */ - { "ccedil", 231 }, /* small c, cedilla */ - { "cedil", 184 }, /* cedilla */ - { "cent", 162 }, /* cent sign */ - { "copy", 169 }, /* copyright sign */ - { "curren", 164 }, /* general currency sign */ - { "deg", 176 }, /* degree sign */ - { "divide", 247 }, /* divide sign */ - { "eacute", 233 }, /* small e, acute accent */ - { "ecirc", 234 }, /* small e, circumflex accent */ - { "egrave", 232 }, /* small e, grave accent */ - { "eth", 240 }, /* small eth, Icelandic */ - { "euml", 235 }, /* small e, dieresis or umlaut mark */ - { "frac12", 189 }, /* fraction one-half */ - { "frac14", 188 }, /* fraction one-quarter */ - { "frac34", 190 }, /* fraction three-quarters */ - { "gt", 62 }, /* greater than */ - { "iacute", 237 }, /* small i, acute accent */ - { "icirc", 238 }, /* small i, circumflex accent */ - { "iexcl", 161 }, /* inverted exclamation mark */ - { "igrave", 236 }, /* small i, grave accent */ - { "iquest", 191 }, /* inverted question mark */ - { "iuml", 239 }, /* small i, dieresis or umlaut mark */ - { "laquo", 171 }, /* angle quotation mark, left */ - { "lt", 60 }, /* less than */ - { "macr", 175 }, /* macron */ - { "micro", 181 }, /* micro sign */ - { "middot", 183 }, /* middle dot */ - { "nbsp", 160 }, /* no-break space */ - { "not", 172 }, /* not sign */ - { "ntilde", 241 }, /* small n, tilde */ - { "oacute", 243 }, /* small o, acute accent */ - { "ocirc", 244 }, /* small o, circumflex accent */ - { "ograve", 242 }, /* small o, grave accent */ - { "ordf", 170 }, /* ordinal indicator, feminine */ - { "ordm", 186 }, /* ordinal indicator, masculine */ - { "oslash", 248 }, /* small o, slash */ - { "otilde", 245 }, /* small o, tilde */ - { "ouml", 246 }, /* small o, dieresis or umlaut mark */ - { "para", 182 }, /* pilcrow (paragraph sign) */ - { "plusmn", 177 }, /* plus-or-minus sign */ - { "pound", 163 }, /* pound sterling sign */ - { "quot", 34 }, /* double quote */ - { "raquo", 187 }, /* angle quotation mark, right */ - { "reg", 174 }, /* registered sign */ - { "sect", 167 }, /* section sign */ - { "shy", 173 }, /* soft hyphen */ - { "sup1", 185 }, /* superscript one */ - { "sup2", 178 }, /* superscript two */ - { "sup3", 179 }, /* superscript three */ - { "szlig", 223 }, /* small sharp s, German (sz ligature) */ - { "thorn", 254 }, /* small thorn, Icelandic */ - { "times", 215 }, /* multiply sign */ - { "uacute", 250 }, /* small u, acute accent */ - { "ucirc", 251 }, /* small u, circumflex accent */ - { "ugrave", 249 }, /* small u, grave accent */ - { "uml", 168 }, /* umlaut (dieresis) */ - { "uuml", 252 }, /* small u, dieresis or umlaut mark */ - { "yacute", 253 }, /* small y, acute accent */ - { "yen", 165 }, /* yen sign */ - { "yuml", 255 }, /* small y, dieresis or umlaut mark */ -}; - -/* - * unvis - decode characters previously encoded by vis - */ -int -unvis(char *cp, int c, int *astate, int flag) -{ - unsigned char uc = (unsigned char)c; - unsigned char st, ia, is, lc; - -/* - * Bottom 8 bits of astate hold the state machine state. - * Top 8 bits hold the current character in the http 1866 nv string decoding - */ -#define GS(a) ((a) & 0xff) -#define SS(a, b) (((uint32_t)(a) << 24) | (b)) -#define GI(a) ((uint32_t)(a) >> 24) - - _DIAGASSERT(cp != NULL); - _DIAGASSERT(astate != NULL); - st = GS(*astate); - - if (flag & UNVIS_END) { - switch (st) { - case S_OCTAL2: - case S_OCTAL3: - case S_HEX2: - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case S_GROUND: - return UNVIS_NOCHAR; - default: - return UNVIS_SYNBAD; - } - } - - switch (st) { - - case S_GROUND: - *cp = 0; - if ((flag & VIS_NOESCAPE) == 0 && c == '\\') { - *astate = SS(0, S_START); - return UNVIS_NOCHAR; - } - if ((flag & VIS_HTTP1808) && c == '%') { - *astate = SS(0, S_HEX1); - return UNVIS_NOCHAR; - } - if ((flag & VIS_HTTP1866) && c == '&') { - *astate = SS(0, S_AMP); - return UNVIS_NOCHAR; - } - if ((flag & VIS_MIMESTYLE) && c == '=') { - *astate = SS(0, S_MIME1); - return UNVIS_NOCHAR; - } - *cp = c; - return UNVIS_VALID; - - case S_START: - switch(c) { - case '\\': - *cp = c; - *astate = SS(0, 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 = SS(0, S_OCTAL2); - return UNVIS_NOCHAR; - case 'M': - *cp = (char)0200; - *astate = SS(0, S_META); - return UNVIS_NOCHAR; - case '^': - *astate = SS(0, S_CTRL); - return UNVIS_NOCHAR; - case 'n': - *cp = '\n'; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case 'r': - *cp = '\r'; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case 'b': - *cp = '\b'; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case 'a': - *cp = '\007'; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case 'v': - *cp = '\v'; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case 't': - *cp = '\t'; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case 'f': - *cp = '\f'; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case 's': - *cp = ' '; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case 'E': - *cp = '\033'; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - case '\n': - /* - * hidden newline - */ - *astate = SS(0, S_GROUND); - return UNVIS_NOCHAR; - case '$': - /* - * hidden marker - */ - *astate = SS(0, S_GROUND); - return UNVIS_NOCHAR; - } - goto bad; - - case S_META: - if (c == '-') - *astate = SS(0, S_META1); - else if (c == '^') - *astate = SS(0, S_CTRL); - else - goto bad; - return UNVIS_NOCHAR; - - case S_META1: - *astate = SS(0, S_GROUND); - *cp |= c; - return UNVIS_VALID; - - case S_CTRL: - if (c == '?') - *cp |= 0177; - else - *cp |= c & 037; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - - case S_OCTAL2: /* second possible octal digit */ - if (isoctal(uc)) { - /* - * yes - and maybe a third - */ - *cp = (*cp << 3) + (c - '0'); - *astate = SS(0, S_OCTAL3); - return UNVIS_NOCHAR; - } - /* - * no - done with current sequence, push back passed char - */ - *astate = SS(0, S_GROUND); - return UNVIS_VALIDPUSH; - - case S_OCTAL3: /* third possible octal digit */ - *astate = SS(0, S_GROUND); - if (isoctal(uc)) { - *cp = (*cp << 3) + (c - '0'); - return UNVIS_VALID; - } - /* - * we were done, push back passed char - */ - return UNVIS_VALIDPUSH; - - case S_HEX1: - if (isxdigit(uc)) { - *cp = xtod(uc); - *astate = SS(0, S_HEX2); - return UNVIS_NOCHAR; - } - /* - * no - done with current sequence, push back passed char - */ - *astate = SS(0, S_GROUND); - return UNVIS_VALIDPUSH; - - case S_HEX2: - *astate = S_GROUND; - if (isxdigit(uc)) { - *cp = xtod(uc) | (*cp << 4); - return UNVIS_VALID; - } - return UNVIS_VALIDPUSH; - - case S_MIME1: - if (uc == '\n' || uc == '\r') { - *astate = SS(0, S_EATCRNL); - return UNVIS_NOCHAR; - } - if (isxdigit(uc) && (isdigit(uc) || isupper(uc))) { - *cp = XTOD(uc); - *astate = SS(0, S_MIME2); - return UNVIS_NOCHAR; - } - goto bad; - - case S_MIME2: - if (isxdigit(uc) && (isdigit(uc) || isupper(uc))) { - *astate = SS(0, S_GROUND); - *cp = XTOD(uc) | (*cp << 4); - return UNVIS_VALID; - } - goto bad; - - case S_EATCRNL: - switch (uc) { - case '\r': - case '\n': - return UNVIS_NOCHAR; - case '=': - *astate = SS(0, S_MIME1); - return UNVIS_NOCHAR; - default: - *cp = uc; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - } - - case S_AMP: - *cp = 0; - if (uc == '#') { - *astate = SS(0, S_NUMBER); - return UNVIS_NOCHAR; - } - *astate = SS(0, S_STRING); - /*FALLTHROUGH*/ - - case S_STRING: - ia = *cp; /* index in the array */ - is = GI(*astate); /* index in the string */ - lc = is == 0 ? 0 : nv[ia].name[is - 1]; /* last character */ - - if (uc == ';') - uc = '\0'; - - for (; ia < __arraycount(nv); ia++) { - if (is != 0 && nv[ia].name[is - 1] != lc) - goto bad; - if (nv[ia].name[is] == uc) - break; - } - - if (ia == __arraycount(nv)) - goto bad; - - if (uc != 0) { - *cp = ia; - *astate = SS(is + 1, S_STRING); - return UNVIS_NOCHAR; - } - - *cp = nv[ia].value; - *astate = SS(0, S_GROUND); - return UNVIS_VALID; - - case S_NUMBER: - if (uc == ';') - return UNVIS_VALID; - if (!isdigit(uc)) - goto bad; - *cp += (*cp * 10) + uc - '0'; - return UNVIS_NOCHAR; - - default: - bad: - /* - * decoder in unknown state - (probably uninitialized) - */ - *astate = SS(0, S_GROUND); - return UNVIS_SYNBAD; - } -} - -/* - * strnunvisx - decode src into dst - * - * Number of chars decoded into dst is returned, -1 on error. - * Dst is null terminated. - */ - -int -strnunvisx(char *dst, size_t dlen, const char *src, int flag) -{ - char c; - char t, *start = dst; - int state = 0; - - _DIAGASSERT(src != NULL); - _DIAGASSERT(dst != NULL); -#define CHECKSPACE() \ - do { \ - if (dlen-- == 0) { \ - errno = ENOSPC; \ - return -1; \ - } \ - } while (/*CONSTCOND*/0) - - while ((c = *src++) != '\0') { - again: - switch (unvis(&t, c, &state, flag)) { - case UNVIS_VALID: - CHECKSPACE(); - *dst++ = t; - break; - case UNVIS_VALIDPUSH: - CHECKSPACE(); - *dst++ = t; - goto again; - case 0: - case UNVIS_NOCHAR: - break; - case UNVIS_SYNBAD: - errno = EINVAL; - return -1; - default: - _DIAGASSERT(0); - errno = EINVAL; - return -1; - } - } - if (unvis(&t, c, &state, UNVIS_END) == UNVIS_VALID) { - CHECKSPACE(); - *dst++ = t; - } - CHECKSPACE(); - *dst = '\0'; - return (int)(dst - start); -} - -int -strunvisx(char *dst, const char *src, int flag) -{ - return strnunvisx(dst, (size_t)~0, src, flag); -} - -int -strunvis(char *dst, const char *src) -{ - return strnunvisx(dst, (size_t)~0, src, 0); -} - -int -strnunvis(char *dst, size_t dlen, const char *src) -{ - return strnunvisx(dst, dlen, src, 0); -} -#endif diff --git a/cmd-line-utils/libedit/np/vis.c b/cmd-line-utils/libedit/np/vis.c deleted file mode 100644 index 884a7894332..00000000000 --- a/cmd-line-utils/libedit/np/vis.c +++ /dev/null @@ -1,582 +0,0 @@ -/* $NetBSD: vis.c,v 1.44 2011/03/12 19:52:48 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. 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. - */ - -/*- - * Copyright (c) 1999, 2005 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 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" - -#if defined(LIBC_SCCS) && !defined(lint) -#endif /* LIBC_SCCS and not lint */ - -/* XXXMYSQL : Make compiler happy. */ -#ifdef _LIBC -#include "namespace.h" -#endif - -#include - -#include -/* - XXXMYSQL : Due to different versions of vis.h available, - use the one bundled with libedit. -*/ -#include "np/vis.h" -#include -#include - -#ifdef __weak_alias -__weak_alias(strvisx,_strvisx); -#endif - -#if !HAVE_VIS || !HAVE_SVIS -#include -#include -#include -#include - -static char *do_svis(char *, size_t *, int, int, int, const char *); - -#undef BELL -#define BELL '\a' - -#define isoctal(c) (((u_char)(c)) >= '0' && ((u_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 XTOA(c) "0123456789ABCDEF"[c] - -#define MAXEXTRAS 5 - -#define MAKEEXTRALIST(flag, extra, orig_str) \ -do { \ - const char *orig = orig_str; \ - const char *o = orig; \ - char *e; \ - while (*o++) \ - continue; \ - extra = malloc((size_t)((o - orig) + MAXEXTRAS)); \ - if (!extra) break; \ - 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 do_hvis, for HTTP style (RFC 1808) - */ -static char * -do_hvis(char *dst, size_t *dlen, int c, int flag, int nextc, const char *extra) -{ - - if ((isascii(c) && isalnum(c)) - /* safe */ - || c == '$' || c == '-' || c == '_' || c == '.' || c == '+' - /* extra */ - || c == '!' || c == '*' || c == '\'' || c == '(' || c == ')' - || c == ',') { - dst = do_svis(dst, dlen, c, flag, nextc, extra); - } else { - if (dlen) { - if (*dlen < 3) - return NULL; - *dlen -= 3; - } - *dst++ = '%'; - *dst++ = xtoa(((unsigned int)c >> 4) & 0xf); - *dst++ = xtoa((unsigned int)c & 0xf); - } - - return dst; -} - -/* - * This is do_mvis, for Quoted-Printable MIME (RFC 2045) - * NB: No handling of long lines or CRLF. - */ -static char * -do_mvis(char *dst, size_t *dlen, int c, int flag, int nextc, const char *extra) -{ - if ((c != '\n') && - /* Space at the end of the line */ - ((isspace(c) && (nextc == '\r' || nextc == '\n')) || - /* Out of range */ - (!isspace(c) && (c < 33 || (c > 60 && c < 62) || c > 126)) || - /* Specific char to be escaped */ - strchr("#$@[\\]^`{|}~", c) != NULL)) { - if (dlen) { - if (*dlen < 3) - return NULL; - *dlen -= 3; - } - *dst++ = '='; - *dst++ = XTOA(((unsigned int)c >> 4) & 0xf); - *dst++ = XTOA((unsigned int)c & 0xf); - } else { - dst = do_svis(dst, dlen, c, flag, nextc, extra); - } - return dst; -} - -/* - * This is do_vis, the central code 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. - */ -static char * -do_svis(char *dst, size_t *dlen, int c, int flag, int nextc, const char *extra) -{ - int isextra; - size_t odlen = dlen ? *dlen : 0; - - isextra = strchr(extra, c) != NULL; -#define HAVE(x) \ - do { \ - if (dlen) { \ - if (*dlen < (x)) \ - goto out; \ - *dlen -= (x); \ - } \ - } while (/*CONSTCOND*/0) - if (!isextra && isascii(c) && (isgraph(c) || iswhite(c) || - ((flag & VIS_SAFE) && issafe(c)))) { - HAVE(1); - *dst++ = c; - return dst; - } - if (flag & VIS_CSTYLE) { - HAVE(2); - switch (c) { - case '\n': - *dst++ = '\\'; *dst++ = 'n'; - return dst; - case '\r': - *dst++ = '\\'; *dst++ = 'r'; - return dst; - case '\b': - *dst++ = '\\'; *dst++ = 'b'; - return dst; - case BELL: - *dst++ = '\\'; *dst++ = 'a'; - return dst; - case '\v': - *dst++ = '\\'; *dst++ = 'v'; - return dst; - case '\t': - *dst++ = '\\'; *dst++ = 't'; - return dst; - case '\f': - *dst++ = '\\'; *dst++ = 'f'; - return dst; - case ' ': - *dst++ = '\\'; *dst++ = 's'; - return dst; - case '\0': - *dst++ = '\\'; *dst++ = '0'; - if (isoctal(nextc)) { - HAVE(2); - *dst++ = '0'; - *dst++ = '0'; - } - return dst; - default: - if (isgraph(c)) { - *dst++ = '\\'; *dst++ = c; - return dst; - } - if (dlen) - *dlen = odlen; - } - } - if (isextra || ((c & 0177) == ' ') || (flag & VIS_OCTAL)) { - HAVE(4); - *dst++ = '\\'; - *dst++ = (u_char)(((u_int32_t)(u_char)c >> 6) & 03) + '0'; - *dst++ = (u_char)(((u_int32_t)(u_char)c >> 3) & 07) + '0'; - *dst++ = (c & 07) + '0'; - } else { - if ((flag & VIS_NOSLASH) == 0) { - HAVE(1); - *dst++ = '\\'; - } - - if (c & 0200) { - HAVE(1); - c &= 0177; *dst++ = 'M'; - } - - if (iscntrl(c)) { - HAVE(2); - *dst++ = '^'; - if (c == 0177) - *dst++ = '?'; - else - *dst++ = c + '@'; - } else { - HAVE(2); - *dst++ = '-'; *dst++ = c; - } - } - return dst; -out: - *dlen = odlen; - return NULL; -} - -typedef char *(*visfun_t)(char *, size_t *, int, int, int, const char *); - -/* - * Return the appropriate encoding function depending on the flags given. - */ -static visfun_t -getvisfun(int flag) -{ - if (flag & VIS_HTTPSTYLE) - return do_hvis; - if (flag & VIS_MIMESTYLE) - return do_mvis; - return do_svis; -} - -/* - * isnvis - visually encode characters, also encoding the characters - * pointed to by `extra' - */ -static char * -isnvis(char *dst, size_t *dlen, int c, int flag, int nextc, const char *extra) -{ - char *nextra = NULL; - visfun_t f; - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(extra != NULL); - MAKEEXTRALIST(flag, nextra, extra); - if (!nextra) { - if (dlen && *dlen == 0) { - errno = ENOSPC; - return NULL; - } - *dst = '\0'; /* can't create nextra, return "" */ - return dst; - } - f = getvisfun(flag); - dst = (*f)(dst, dlen, c, flag, nextc, nextra); - free(nextra); - if (dst == NULL || (dlen && *dlen == 0)) { - errno = ENOSPC; - return NULL; - } - *dst = '\0'; - return dst; -} - -char * -svis(char *dst, int c, int flag, int nextc, const char *extra) -{ - return isnvis(dst, NULL, c, flag, nextc, extra); -} - -char * -snvis(char *dst, size_t dlen, int c, int flag, int nextc, const char *extra) -{ - return isnvis(dst, &dlen, c, flag, nextc, extra); -} - - -/* - * 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. - */ -static int -istrsnvis(char *dst, size_t *dlen, const char *csrc, int flag, const char *extra) -{ - int c; - char *start; - char *nextra = NULL; - const unsigned char *src = (const unsigned char *)csrc; - visfun_t f; - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - _DIAGASSERT(extra != NULL); - MAKEEXTRALIST(flag, nextra, extra); - if (!nextra) { - *dst = '\0'; /* can't create nextra, return "" */ - return 0; - } - f = getvisfun(flag); - for (start = dst; (c = *src++) != '\0'; /* empty */) { - dst = (*f)(dst, dlen, c, flag, *src, nextra); - if (dst == NULL) { - errno = ENOSPC; - return -1; - } - } - free(nextra); - if (dlen && *dlen == 0) { - errno = ENOSPC; - return -1; - } - *dst = '\0'; - return (int)(dst - start); -} - -int -strsvis(char *dst, const char *csrc, int flag, const char *extra) -{ - return istrsnvis(dst, NULL, csrc, flag, extra); -} - -int -strsnvis(char *dst, size_t dlen, const char *csrc, int flag, const char *extra) -{ - return istrsnvis(dst, &dlen, csrc, flag, extra); -} - -static int -istrsnvisx(char *dst, size_t *dlen, const char *csrc, size_t len, int flag, - const char *extra) -{ - unsigned char c; - char *start; - char *nextra = NULL; - const unsigned char *src = (const unsigned char *)csrc; - visfun_t f; - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - _DIAGASSERT(extra != NULL); - MAKEEXTRALIST(flag, nextra, extra); - if (! nextra) { - if (dlen && *dlen == 0) { - errno = ENOSPC; - return -1; - } - *dst = '\0'; /* can't create nextra, return "" */ - return 0; - } - - f = getvisfun(flag); - for (start = dst; len > 0; len--) { - c = *src++; - dst = (*f)(dst, dlen, c, flag, len > 1 ? *src : '\0', nextra); - if (dst == NULL) { - errno = ENOSPC; - return -1; - } - } - free(nextra); - if (dlen && *dlen == 0) { - errno = ENOSPC; - return -1; - } - *dst = '\0'; - return (int)(dst - start); -} - -int -strsvisx(char *dst, const char *csrc, size_t len, int flag, const char *extra) -{ - return istrsnvisx(dst, NULL, csrc, len, flag, extra); -} - -int -strsnvisx(char *dst, size_t dlen, const char *csrc, size_t len, int flag, - const char *extra) -{ - return istrsnvisx(dst, &dlen, csrc, len, flag, extra); -} -#endif - -#if !HAVE_VIS -/* - * vis - visually encode characters - */ -static char * -invis(char *dst, size_t *dlen, int c, int flag, int nextc) -{ - char *extra = NULL; - unsigned char uc = (unsigned char)c; - visfun_t f; - - _DIAGASSERT(dst != NULL); - - MAKEEXTRALIST(flag, extra, ""); - if (! extra) { - if (dlen && *dlen == 0) { - errno = ENOSPC; - return NULL; - } - *dst = '\0'; /* can't create extra, return "" */ - return dst; - } - f = getvisfun(flag); - dst = (*f)(dst, dlen, uc, flag, nextc, extra); - free(extra); - if (dst == NULL || (dlen && *dlen == 0)) { - errno = ENOSPC; - return NULL; - } - *dst = '\0'; - return dst; -} - -char * -vis(char *dst, int c, int flag, int nextc) -{ - return invis(dst, NULL, c, flag, nextc); -} - -char * -nvis(char *dst, size_t dlen, int c, int flag, int nextc) -{ - return invis(dst, &dlen, c, flag, nextc); -} - - -/* - * 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. - */ -static int -istrnvis(char *dst, size_t *dlen, const char *src, int flag) -{ - char *extra = NULL; - int rv; - - MAKEEXTRALIST(flag, extra, ""); - if (!extra) { - if (dlen && *dlen == 0) { - errno = ENOSPC; - return -1; - } - *dst = '\0'; /* can't create extra, return "" */ - return 0; - } - rv = istrsnvis(dst, dlen, src, flag, extra); - free(extra); - return rv; -} - -int -strvis(char *dst, const char *src, int flag) -{ - return istrnvis(dst, NULL, src, flag); -} - -int -strnvis(char *dst, size_t dlen, const char *src, int flag) -{ - return istrnvis(dst, &dlen, src, flag); -} - -static int -istrnvisx(char *dst, size_t *dlen, const char *src, size_t len, int flag) -{ - char *extra = NULL; - int rv; - - MAKEEXTRALIST(flag, extra, ""); - if (!extra) { - if (dlen && *dlen == 0) { - errno = ENOSPC; - return -1; - } - *dst = '\0'; /* can't create extra, return "" */ - return 0; - } - rv = istrsnvisx(dst, dlen, src, len, flag, extra); - free(extra); - return rv; -} - -int -strvisx(char *dst, const char *src, size_t len, int flag) -{ - return istrnvisx(dst, NULL, src, len, flag); -} - -int -strnvisx(char *dst, size_t dlen, const char *src, size_t len, int flag) -{ - return istrnvisx(dst, &dlen, src, len, flag); -} - -#endif diff --git a/cmd-line-utils/libedit/np/vis.h b/cmd-line-utils/libedit/np/vis.h deleted file mode 100644 index 54a76e9108f..00000000000 --- a/cmd-line-utils/libedit/np/vis.h +++ /dev/null @@ -1,114 +0,0 @@ -/* $NetBSD: vis.h,v 1.19 2011/03/12 19:52:45 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. 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_ - -#include - -/* - * to select alternate encoding format - */ -#define VIS_OCTAL 0x001 /* use octal \ddd format */ -#define VIS_CSTYLE 0x002 /* 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 0x004 /* also encode space */ -#define VIS_TAB 0x008 /* also encode tab */ -#define VIS_NL 0x010 /* also encode newline */ -#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL) -#define VIS_SAFE 0x020 /* only encode "unsafe" characters */ - -/* - * other - */ -#define VIS_NOSLASH 0x040 /* inhibit printing '\' */ -#define VIS_HTTP1808 0x080 /* http-style escape % hex hex */ -#define VIS_HTTPSTYLE 0x080 /* http-style escape % hex hex */ -#define VIS_MIMESTYLE 0x100 /* mime-style escape = HEX HEX */ -#define VIS_HTTP1866 0x200 /* http-style &#num; or &string; */ -#define VIS_NOESCAPE 0x400 /* don't decode `\' */ -#define _VIS_END 0x800 /* for unvis */ - -/* - * 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 _VIS_END /* no more characters */ -/* XXXMYSQL */ -#ifndef __RENAME -#define __RENAME(x) -#endif - -__BEGIN_DECLS -char *vis(char *, int, int, int); -char *nvis(char *, size_t, int, int, int); - -char *svis(char *, int, int, int, const char *); -char *snvis(char *, size_t, int, int, int, const char *); - -int strvis(char *, const char *, int); -int strnvis(char *, size_t, const char *, int); - -int strsvis(char *, const char *, int, const char *); -int strsnvis(char *, size_t, const char *, int, const char *); - -int strvisx(char *, const char *, size_t, int); -int strnvisx(char *, size_t, const char *, size_t, int); - -int strsvisx(char *, const char *, size_t, int, const char *); -int strsnvisx(char *, size_t, const char *, size_t, int, const char *); - -int strunvis(char *, const char *); -int strnunvis(char *, size_t, const char *); - -int strunvisx(char *, const char *, int); -int strnunvisx(char *, size_t, const char *, int); - -#ifndef __LIBC12_SOURCE__ -int unvis(char *, int, int *, int) __RENAME(__unvis50); -#endif -__END_DECLS - -#endif /* !_VIS_H_ */ diff --git a/cmd-line-utils/libedit/np/wcsdup.c b/cmd-line-utils/libedit/np/wcsdup.c deleted file mode 100644 index 2a77375e0b7..00000000000 --- a/cmd-line-utils/libedit/np/wcsdup.c +++ /dev/null @@ -1,43 +0,0 @@ -/* $NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $ */ - -/* - * Copyright (C) 2006 Aleksey Cheusov - * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use or copy this software for any purpose is hereby granted - * without fee. Permission to modify the code and to distribute modified - * code is also granted without any restrictions. - */ - -#ifndef HAVE_WCSDUP - -#include "config.h" - -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -wchar_t * -wcsdup(const wchar_t *str) -{ - wchar_t *copy; - size_t len; - - _DIAGASSERT(str != NULL); - - len = wcslen(str) + 1; - copy = malloc(len * sizeof (wchar_t)); - - if (!copy) - return NULL; - - return wmemcpy(copy, str, len); -} - -#endif diff --git a/cmd-line-utils/libedit/parse.c b/cmd-line-utils/libedit/parse.c deleted file mode 100644 index b14e4ae7165..00000000000 --- a/cmd-line-utils/libedit/parse.c +++ /dev/null @@ -1,284 +0,0 @@ -/* $NetBSD: parse.c,v 1.26 2011/08/16 16:25:15 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * parse.c: parse an editline extended command - * - * commands are: - * - * bind - * echotc - * edit - * gettc - * history - * settc - * setty - */ -#include "el.h" -#include - -private const struct { - const Char *name; - int (*func)(EditLine *, int, const Char **); -} cmds[] = { - { STR("bind"), map_bind }, - { STR("echotc"), terminal_echotc }, - { STR("edit"), el_editmode }, - { STR("history"), hist_command }, - { STR("telltc"), terminal_telltc }, - { STR("settc"), terminal_settc }, - { STR("setty"), tty_stty }, - { NULL, NULL } -}; - - -/* parse_line(): - * Parse a line and dispatch it - */ -protected int -parse_line(EditLine *el, const Char *line) -{ - const Char **argv; - int argc; - TYPE(Tokenizer) *tok; - - tok = FUN(tok,init)(NULL); - FUN(tok,str)(tok, line, &argc, &argv); - argc = FUN(el,parse)(el, argc, argv); - FUN(tok,end)(tok); - return argc; -} - - -/* el_parse(): - * Command dispatcher - */ -public int -FUN(el,parse)(EditLine *el, int argc, const Char *argv[]) -{ - const Char *ptr; - int i; - - if (argc < 1) - return -1; - ptr = Strchr(argv[0], ':'); - if (ptr != NULL) { - Char *tprog; - size_t l; - - if (ptr == argv[0]) - return 0; - l = (size_t)(ptr - argv[0] - 1); - tprog = el_malloc((l + 1) * sizeof(*tprog)); - if (tprog == NULL) - return 0; - (void) Strncpy(tprog, argv[0], l); - tprog[l] = '\0'; - ptr++; - l = (size_t)el_match(el->el_prog, tprog); - el_free(tprog); - if (!l) - return 0; - } else - ptr = argv[0]; - - for (i = 0; cmds[i].name != NULL; i++) - if (Strcmp(cmds[i].name, ptr) == 0) { - i = (*cmds[i].func) (el, argc, argv); - return -i; - } - return -1; -} - - -/* parse__escape(): - * Parse a string of the form ^ \ \ \U+xxxx and return - * the appropriate character or -1 if the escape is not valid - */ -protected int -parse__escape(const Char **ptr) -{ - const Char *p; - Int c; - - p = *ptr; - - if (p[1] == 0) - return -1; - - if (*p == '\\') { - p++; - switch (*p) { - case 'a': - c = '\007'; /* Bell */ - break; - case 'b': - c = '\010'; /* Backspace */ - break; - case 't': - c = '\011'; /* Horizontal Tab */ - break; - case 'n': - c = '\012'; /* New Line */ - break; - case 'v': - c = '\013'; /* Vertical Tab */ - break; - case 'f': - c = '\014'; /* Form Feed */ - break; - case 'r': - c = '\015'; /* Carriage Return */ - break; - case 'e': - c = '\033'; /* Escape */ - break; - case 'U': /* Unicode \U+xxxx or \U+xxxxx format */ - { - int i; - const Char hex[] = STR("0123456789ABCDEF"); - const Char *h; - ++p; - if (*p++ != '+') - return -1; - c = 0; - for (i = 0; i < 5; ++i) { - h = Strchr(hex, *p++); - if (!h && i < 4) - return -1; - else if (h) - c = (c << 4) | ((int)(h - hex)); - else - --p; - } - if (c > 0x10FFFF) /* outside valid character range */ - return -1; - break; - } - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - { - int cnt, ch; - - for (cnt = 0, c = 0; cnt < 3; cnt++) { - ch = *p++; - if (ch < '0' || ch > '7') { - p--; - break; - } - c = (c << 3) | (ch - '0'); - } - if ((c & (wint_t)0xffffff00) != (wint_t)0) - return -1; - --p; - break; - } - default: - c = *p; - break; - } - } else if (*p == '^') { - p++; - c = (*p == '?') ? '\177' : (*p & 0237); - } else - c = *p; - *ptr = ++p; - return c; -} - -/* parse__string(): - * Parse the escapes from in and put the raw string out - */ -protected Char * -parse__string(Char *out, const Char *in) -{ - Char *rv = out; - int n; - - for (;;) - switch (*in) { - case '\0': - *out = '\0'; - return rv; - - case '\\': - case '^': - if ((n = parse__escape(&in)) == -1) - return NULL; - *out++ = n; - break; - - case 'M': - if (in[1] == '-' && in[2] != '\0') { - *out++ = '\033'; - in += 2; - break; - } - /*FALLTHROUGH*/ - - default: - *out++ = *in++; - break; - } -} - - -/* parse_cmd(): - * Return the command number for the command string given - * or -1 if one is not found - */ -protected int -parse_cmd(EditLine *el, const Char *cmd) -{ - el_bindings_t *b; - - for (b = el->el_map.help; b->name != NULL; b++) - if (Strcmp(b->name, cmd) == 0) - return b->func; - return -1; -} diff --git a/cmd-line-utils/libedit/parse.h b/cmd-line-utils/libedit/parse.h deleted file mode 100644 index ec04051bc27..00000000000 --- a/cmd-line-utils/libedit/parse.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: parse.h,v 1.7 2009/12/30 22:37:40 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)parse.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.parse.h: Parser functions - */ -#ifndef _h_el_parse -#define _h_el_parse - -protected int parse_line(EditLine *, const Char *); -protected int parse__escape(const Char **); -protected Char *parse__string(Char *, const Char *); -protected int parse_cmd(EditLine *, const Char *); - -#endif /* _h_el_parse */ diff --git a/cmd-line-utils/libedit/prompt.c b/cmd-line-utils/libedit/prompt.c deleted file mode 100644 index 3f8d73303ec..00000000000 --- a/cmd-line-utils/libedit/prompt.c +++ /dev/null @@ -1,198 +0,0 @@ -/* $NetBSD: prompt.c,v 1.20 2011/07/29 15:16:33 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)prompt.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * prompt.c: Prompt printing functions - */ -#include -#include "el.h" - -private Char *prompt_default(EditLine *); -private Char *prompt_default_r(EditLine *); - -/* prompt_default(): - * Just a default prompt, in case the user did not provide one - */ -private Char * -/*ARGSUSED*/ -prompt_default(EditLine *el __attribute__((__unused__))) -{ - static Char a[3] = {'?', ' ', '\0'}; - - return a; -} - - -/* prompt_default_r(): - * Just a default rprompt, in case the user did not provide one - */ -private Char * -/*ARGSUSED*/ -prompt_default_r(EditLine *el __attribute__((__unused__))) -{ - static Char a[1] = {'\0'}; - - return a; -} - - -/* prompt_print(): - * Print the prompt and update the prompt position. - */ -protected void -prompt_print(EditLine *el, int op) -{ - el_prompt_t *elp; - Char *p; - int ignore = 0; - - if (op == EL_PROMPT) - elp = &el->el_prompt; - else - elp = &el->el_rprompt; - - if (elp->p_wide) - p = (*elp->p_func)(el); - else - p = ct_decode_string((char *)(void *)(*elp->p_func)(el), - &el->el_scratch); - - for (; *p; p++) { - if (elp->p_ignore == *p) { - ignore = !ignore; - continue; - } - if (ignore) - terminal__putc(el, *p); - else - re_putc(el, *p, 1); - } - - elp->p_pos.v = el->el_refresh.r_cursor.v; - elp->p_pos.h = el->el_refresh.r_cursor.h; -} - - -/* prompt_init(): - * Initialize the prompt stuff - */ -protected int -prompt_init(EditLine *el) -{ - - el->el_prompt.p_func = prompt_default; - el->el_prompt.p_pos.v = 0; - el->el_prompt.p_pos.h = 0; - el->el_prompt.p_ignore = '\0'; - el->el_rprompt.p_func = prompt_default_r; - el->el_rprompt.p_pos.v = 0; - el->el_rprompt.p_pos.h = 0; - el->el_rprompt.p_ignore = '\0'; - return 0; -} - - -/* prompt_end(): - * Clean up the prompt stuff - */ -protected void -/*ARGSUSED*/ -prompt_end(EditLine *el __attribute__((__unused__))) -{ -} - - -/* prompt_set(): - * Install a prompt printing function - */ -protected int -prompt_set(EditLine *el, el_pfunc_t prf, Char c, int op, int wide) -{ - el_prompt_t *p; - - if (op == EL_PROMPT || op == EL_PROMPT_ESC) - p = &el->el_prompt; - else - p = &el->el_rprompt; - - if (prf == NULL) { - if (op == EL_PROMPT || op == EL_PROMPT_ESC) - p->p_func = prompt_default; - else - p->p_func = prompt_default_r; - } else { - p->p_func = prf; - } - - p->p_ignore = c; - - p->p_pos.v = 0; - p->p_pos.h = 0; - p->p_wide = wide; - - return 0; -} - - -/* prompt_get(): - * Retrieve the prompt printing function - */ -protected int -prompt_get(EditLine *el, el_pfunc_t *prf, Char *c, int op) -{ - el_prompt_t *p; - - if (prf == NULL) - return -1; - - if (op == EL_PROMPT) - p = &el->el_prompt; - else - p = &el->el_rprompt; - - if (prf) - *prf = p->p_func; - if (c) - *c = p->p_ignore; - - return 0; -} diff --git a/cmd-line-utils/libedit/prompt.h b/cmd-line-utils/libedit/prompt.h deleted file mode 100644 index af63b82b684..00000000000 --- a/cmd-line-utils/libedit/prompt.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: prompt.h,v 1.10 2009/12/30 22:37:40 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)prompt.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.prompt.h: Prompt printing stuff - */ -#ifndef _h_el_prompt -#define _h_el_prompt - -#include "histedit.h" - -typedef Char *(*el_pfunc_t)(EditLine *); - -typedef struct el_prompt_t { - el_pfunc_t p_func; /* Function to return the prompt */ - coord_t p_pos; /* position in the line after prompt */ - Char p_ignore; /* character to start/end literal */ - int p_wide; -} el_prompt_t; - -protected void prompt_print(EditLine *, int); -protected int prompt_set(EditLine *, el_pfunc_t, Char, int, int); -protected int prompt_get(EditLine *, el_pfunc_t *, Char *, int); -protected int prompt_init(EditLine *); -protected void prompt_end(EditLine *); - -#endif /* _h_el_prompt */ diff --git a/cmd-line-utils/libedit/read.c b/cmd-line-utils/libedit/read.c deleted file mode 100644 index a919b888965..00000000000 --- a/cmd-line-utils/libedit/read.c +++ /dev/null @@ -1,722 +0,0 @@ -/* $NetBSD: read.c,v 1.67 2011/08/16 16:25:15 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * read.c: Clean this junk up! This is horrible code. - * Terminal read functions - */ -#include -#include -#include -#include -#include -#include "el.h" - -#define OKCMD -1 /* must be -1! */ - -private int read__fixio(int, int); -private int read_preread(EditLine *); -private int read_char(EditLine *, Char *); -private int read_getcmd(EditLine *, el_action_t *, Char *); -private void read_pop(c_macro_t *); - -/* 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 -read_debug(EditLine *el) -{ - - if (el->el_line.cursor > el->el_line.lastchar) - (void) fprintf(el->el_errfile, "cursor > lastchar\r\n"); - if (el->el_line.cursor < el->el_line.buffer) - (void) fprintf(el->el_errfile, "cursor < buffer\r\n"); - if (el->el_line.cursor > el->el_line.limit) - (void) fprintf(el->el_errfile, "cursor > limit\r\n"); - if (el->el_line.lastchar > el->el_line.limit) - (void) fprintf(el->el_errfile, "lastchar > limit\r\n"); - if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2]) - (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n"); -} -#endif /* DEBUG_EDIT */ - - -/* read__fixio(): - * Try to recover from a read error - */ -/* ARGSUSED */ -private int -read__fixio(int fd __attribute__((__unused__)), int e) -{ - - switch (e) { - case -1: /* Make sure that the code is reachable */ - -#ifdef EWOULDBLOCK - case EWOULDBLOCK: -#ifndef TRY_AGAIN -#define TRY_AGAIN -#endif -#endif /* EWOULDBLOCK */ - -#if defined(POSIX) && defined(EAGAIN) -#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN - case EAGAIN: -#ifndef TRY_AGAIN -#define TRY_AGAIN -#endif -#endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */ -#endif /* POSIX && EAGAIN */ - - e = 0; -#ifdef TRY_AGAIN -#if defined(F_SETFL) && defined(O_NDELAY) - if ((e = fcntl(fd, F_GETFL, 0)) == -1) - return -1; - - if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1) - return -1; - else - e = 1; -#endif /* F_SETFL && O_NDELAY */ - -#ifdef FIONBIO - { - int zero = 0; - - if (ioctl(fd, FIONBIO, &zero) == -1) - return -1; - else - e = 1; - } -#endif /* FIONBIO */ - -#endif /* TRY_AGAIN */ - return e ? 0 : -1; - - case EINTR: - return 0; - - default: - return -1; - } -} - - -/* read_preread(): - * Try to read the stuff in the input queue; - */ -private int -read_preread(EditLine *el) -{ - int chrs = 0; - - if (el->el_tty.t_mode == ED_IO) - return 0; - -#ifndef WIDECHAR -/* FIONREAD attempts to buffer up multiple bytes, and to make that work - * properly with partial wide/UTF-8 characters would need some careful work. */ -#ifdef FIONREAD - (void) ioctl(el->el_infd, FIONREAD, &chrs); - if (chrs > 0) { - char buf[EL_BUFSIZ]; - - chrs = read(el->el_infd, buf, - (size_t) MIN(chrs, EL_BUFSIZ - 1)); - if (chrs > 0) { - buf[chrs] = '\0'; - el_push(el, buf); - } - } -#endif /* FIONREAD */ -#endif - return chrs > 0; -} - - -/* el_push(): - * Push a macro - */ -public void -FUN(el,push)(EditLine *el, const Char *str) -{ - c_macro_t *ma = &el->el_chared.c_macro; - - if (str != NULL && ma->level + 1 < EL_MAXMACRO) { - ma->level++; - if ((ma->macro[ma->level] = Strdup(str)) != NULL) - return; - ma->level--; - } - terminal_beep(el); - terminal__flush(el); -} - - -/* read_getcmd(): - * Return next command from the input stream. - * Character values > 255 are not looked up in the map, but inserted. - */ -private int -read_getcmd(EditLine *el, el_action_t *cmdnum, Char *ch) -{ - el_action_t cmd; - int num; - - el->el_errno = 0; - do { - if ((num = FUN(el,getc)(el, ch)) != 1) {/* if EOF or error */ - el->el_errno = num == 0 ? 0 : errno; - return num; - } - -#ifdef KANJI - if ((*ch & 0200)) { - el->el_state.metanext = 0; - cmd = CcViMap[' ']; - break; - } else -#endif /* KANJI */ - - if (el->el_state.metanext) { - el->el_state.metanext = 0; - *ch |= 0200; - } -#ifdef WIDECHAR - if (*ch >= N_KEYS) - cmd = ED_INSERT; - else -#endif - cmd = el->el_map.current[(unsigned char) *ch]; - if (cmd == ED_SEQUENCE_LEAD_IN) { - keymacro_value_t val; - switch (keymacro_get(el, ch, &val)) { - case XK_CMD: - cmd = val.cmd; - break; - case XK_STR: - FUN(el,push)(el, val.str); - break; -#ifdef notyet - case XK_EXE: - /* XXX: In the future to run a user function */ - RunCommand(val.str); - break; -#endif - default: - EL_ABORT((el->el_errfile, "Bad XK_ type \n")); - break; - } - } - if (el->el_map.alt == NULL) - el->el_map.current = el->el_map.key; - } while (cmd == ED_SEQUENCE_LEAD_IN); - *cmdnum = cmd; - return OKCMD; -} - -/* read_char(): - * Read a character from the tty. - */ -private int -read_char(EditLine *el, Char *cp) -{ - ssize_t num_read; - int tried = 0; - char cbuf[MB_LEN_MAX]; - size_t cbp = 0; - int bytes = 0; - -#ifdef WIDECHAR -static mbstate_t state, temp_state; -memset(&state, 0, sizeof(mbstate_t)); -#endif - - again: - el->el_signal->sig_no = 0; - while ((num_read = read(el->el_infd, cbuf + cbp, (size_t)1)) == -1) { - switch (el->el_signal->sig_no) { - case SIGCONT: - FUN(el,set)(el, EL_REFRESH); - /*FALLTHROUGH*/ - case SIGWINCH: - sig_set(el); - goto again; - default: - break; - } - if (!tried && read__fixio(el->el_infd, errno) == 0) - tried = 1; - else { - *cp = '\0'; - return -1; - } - } - -#ifdef WIDECHAR - ++cbp; - if (cbp > (size_t) MB_CUR_MAX) { /* "shouldn't happen" */ - *cp = '\0'; - return (-1); - } - - temp_state= state; - - if ((bytes = mbrtowc(cp, cbuf, cbp, &state)) == -2) - { - /* Incomplete sequence, restore the state and scan more bytes. */ - state= temp_state; - goto again; - } - else if (bytes == -1) - { - /* Invalid sequence, reset the state and continue. */ - cbp= 0; - memset(&state, 0, sizeof(mbstate_t)); - goto again; - } - /* We successfully read one single or multi-byte character */ -#else - *cp = (unsigned char)cbuf[0]; -#endif - -#if 0 - if ((el->el_flags & IGNORE_EXTCHARS) && bytes > 1) { - cbp = 0; /* skip this character */ - goto again; - } -#endif - - return (int)num_read; -} - -/* read_pop(): - * Pop a macro from the stack - */ -private void -read_pop(c_macro_t *ma) -{ - int i; - - el_free(ma->macro[0]); - for (i = 0; i < ma->level; i++) - ma->macro[i] = ma->macro[i + 1]; - ma->level--; - ma->offset = 0; -} - -/* el_getc(): - * Read a character - */ -public int -FUN(el,getc)(EditLine *el, Char *cp) -{ - int num_read; - c_macro_t *ma = &el->el_chared.c_macro; - - terminal__flush(el); - for (;;) { - if (ma->level < 0) { - if (!read_preread(el)) - break; - } - - if (ma->level < 0) - break; - - if (ma->macro[0][ma->offset] == '\0') { - read_pop(ma); - continue; - } - - *cp = ma->macro[0][ma->offset++]; - - if (ma->macro[0][ma->offset] == '\0') { - /* Needed for QuoteMode On */ - read_pop(ma); - } - - return 1; - } - -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, "Turning raw mode on\n"); -#endif /* DEBUG_READ */ - if (tty_rawmode(el) < 0)/* make sure the tty is set up correctly */ - return 0; - -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, "Reading a character\n"); -#endif /* DEBUG_READ */ - num_read = (*el->el_read.read_char)(el, cp); -#ifdef WIDECHAR - if (el->el_flags & NARROW_READ) - *cp = *(char *)(void *)cp; -#endif -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, "Got it %c\n", *cp); -#endif /* DEBUG_READ */ - return num_read; -} - -protected void -read_prepare(EditLine *el) -{ - if (el->el_flags & HANDLE_SIGNALS) - sig_set(el); - if (el->el_flags & NO_TTY) - return; - if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED) - tty_rawmode(el); - - /* 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, 0); - re_refresh(el); /* print the prompt */ - - if (el->el_flags & UNBUFFERED) - terminal__flush(el); -} - -protected void -read_finish(EditLine *el) -{ - if ((el->el_flags & UNBUFFERED) == 0) - (void) tty_cookedmode(el); - if (el->el_flags & HANDLE_SIGNALS) - sig_clr(el); -} - -public const Char * -FUN(el,gets)(EditLine *el, int *nread) -{ - int retval; - el_action_t cmdnum = 0; - int num; /* how many chars we have read at NL */ - Char ch, *cp; - int crlf = 0; - int nrb; -#ifdef FIONREAD - c_macro_t *ma = &el->el_chared.c_macro; -#endif /* FIONREAD */ - - if (nread == NULL) - nread = &nrb; - *nread = 0; - - if (el->el_flags & NO_TTY) { - size_t idx; - - cp = el->el_line.buffer; - while ((num = (*el->el_read.read_char)(el, cp)) == 1) { - /* make sure there is space for next character */ - if (cp + 1 >= el->el_line.limit) { - idx = (size_t)(cp - el->el_line.buffer); - if (!ch_enlargebufs(el, (size_t)2)) - break; - cp = &el->el_line.buffer[idx]; - } - cp++; - if (el->el_flags & UNBUFFERED) - break; - if (cp[-1] == '\r' || cp[-1] == '\n') - break; - } - if (num == -1) { - if (errno == EINTR) - cp = el->el_line.buffer; - el->el_errno = errno; - } - - goto noedit; - } - - -#ifdef FIONREAD - if (el->el_tty.t_mode == EX_IO && ma->level < 0) { - long chrs = 0; - - (void) ioctl(el->el_infd, FIONREAD, &chrs); - if (chrs == 0) { - if (tty_rawmode(el) < 0) { - errno = 0; - *nread = 0; - return NULL; - } - } - } -#endif /* FIONREAD */ - - if ((el->el_flags & UNBUFFERED) == 0) - read_prepare(el); - - if (el->el_flags & EDIT_DISABLED) { - size_t idx; - - if ((el->el_flags & UNBUFFERED) == 0) - cp = el->el_line.buffer; - else - cp = el->el_line.lastchar; - - terminal__flush(el); - - while ((num = (*el->el_read.read_char)(el, cp)) == 1) { - /* make sure there is space next character */ - if (cp + 1 >= el->el_line.limit) { - idx = (size_t)(cp - el->el_line.buffer); - if (!ch_enlargebufs(el, (size_t)2)) - break; - cp = &el->el_line.buffer[idx]; - } - cp++; - crlf = cp[-1] == '\r' || cp[-1] == '\n'; - if (el->el_flags & UNBUFFERED) - break; - if (crlf) - break; - } - - if (num == -1) { - if (errno == EINTR) - cp = el->el_line.buffer; - el->el_errno = errno; - } - - goto noedit; - } - - for (num = OKCMD; num == OKCMD;) { /* while still editing this - * line */ -#ifdef DEBUG_EDIT - read_debug(el); -#endif /* DEBUG_EDIT */ - /* if EOF or error */ - if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) { -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, - "Returning from el_gets %d\n", num); -#endif /* DEBUG_READ */ - break; - } - if (el->el_errno == EINTR) { - el->el_line.buffer[0] = '\0'; - el->el_line.lastchar = - el->el_line.cursor = el->el_line.buffer; - break; - } - 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); -#endif /* DEBUG_EDIT */ - continue; /* try again */ - } - /* now do the real command */ -#ifdef DEBUG_READ - { - el_bindings_t *b; - for (b = el->el_map.help; b->name; b++) - if (b->func == cmdnum) - break; - if (b->name) - (void) fprintf(el->el_errfile, - "Executing %s\n", b->name); - else - (void) fprintf(el->el_errfile, - "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; - - /* use any return value */ - switch (retval) { - case CC_CURSOR: - re_refresh_cursor(el); - break; - - case CC_REDISPLAY: - re_clear_lines(el); - re_clear_display(el); - /* FALLTHROUGH */ - - case CC_REFRESH: - re_refresh(el); - break; - - case CC_REFRESH_BEEP: - re_refresh(el); - terminal_beep(el); - break; - - case CC_NORM: /* normal char */ - break; - - case CC_ARGHACK: /* Suggested by Rich Salz */ - /* */ - continue; /* keep going... */ - - case CC_EOF: /* end of file typed */ - if ((el->el_flags & UNBUFFERED) == 0) - num = 0; - else if (num == -1) { - *el->el_line.lastchar++ = CONTROL('d'); - el->el_line.cursor = el->el_line.lastchar; - num = 1; - } - break; - - case CC_NEWLINE: /* normal end of line */ - num = (int)(el->el_line.lastchar - el->el_line.buffer); - break; - - case CC_FATAL: /* fatal error, reset to known state */ -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, - "*** editor fatal ERROR ***\r\n\n"); -#endif /* DEBUG_READ */ - /* put (real) cursor in a known place */ - re_clear_display(el); /* reset the display stuff */ - ch_reset(el, 1); /* reset the input pointers */ - re_refresh(el); /* print the prompt again */ - break; - - case CC_ERROR: - default: /* functions we don't know about */ -#ifdef DEBUG_READ - (void) fprintf(el->el_errfile, - "*** editor ERROR ***\r\n\n"); -#endif /* DEBUG_READ */ - terminal_beep(el); - terminal__flush(el); - break; - } - el->el_state.argument = 1; - el->el_state.doingarg = 0; - el->el_chared.c_vcmd.action = NOP; - if (el->el_flags & UNBUFFERED) - break; - } - - terminal__flush(el); /* flush any buffered output */ - /* make sure the tty is set up correctly */ - if ((el->el_flags & UNBUFFERED) == 0) { - read_finish(el); - *nread = num != -1 ? num : 0; - } else { - *nread = (int)(el->el_line.lastchar - el->el_line.buffer); - } - goto done; -noedit: - el->el_line.cursor = el->el_line.lastchar = cp; - *cp = '\0'; - *nread = (int)(el->el_line.cursor - el->el_line.buffer); -done: - if (*nread == 0) { - if (num == -1) { - *nread = -1; - errno = el->el_errno; - } - return NULL; - } else - return el->el_line.buffer; -} diff --git a/cmd-line-utils/libedit/read.h b/cmd-line-utils/libedit/read.h deleted file mode 100644 index 852606a9c17..00000000000 --- a/cmd-line-utils/libedit/read.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: read.h,v 1.7 2009/12/30 22:37:40 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. - * - * 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 void read_prepare(EditLine *); -protected void read_finish(EditLine *); -protected int el_read_setfn(EditLine *, el_rfunc_t); -protected el_rfunc_t el_read_getfn(EditLine *); - -#endif /* _h_el_read */ diff --git a/cmd-line-utils/libedit/readline.c b/cmd-line-utils/libedit/readline.c deleted file mode 100644 index a2a92edc1b4..00000000000 --- a/cmd-line-utils/libedit/readline.c +++ /dev/null @@ -1,2294 +0,0 @@ -/* $NetBSD: readline.c,v 1.99 2011/08/16 16:25:15 christos Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jaromir Dolecek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#endif /* not lint && not SCCSID */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_VIS_H -#include -#else -#include "np/vis.h" -#endif -#include "readline/readline.h" -#include "el.h" -#include "fcns.h" /* for EL_NUM_FCNS */ -#include "histedit.h" -#include "filecomplete.h" - -void rl_prep_terminal(int); -void rl_deprep_terminal(void); - -/* for rl_complete() */ -#define TAB '\r' - -/* see comment at the #ifdef for sense of this */ -/* #define GDB_411_HACK */ - -/* readline compatibility stuff - look at readline sources/documentation */ -/* to see what these variables mean */ -const char *rl_library_version = "EditLine wrapper"; -int rl_readline_version = RL_READLINE_VERSION; -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; -int rl_end = 0; -char *rl_line_buffer = NULL; -VCPFunction *rl_linefunc = NULL; -int rl_done = 0; -VFunction *rl_event_hook = NULL; -KEYMAP_ENTRY_ARRAY emacs_standard_keymap, - emacs_meta_keymap, - emacs_ctlx_keymap; - -int history_base = 1; /* probably never subject to change */ -int history_length = 0; -int max_input_history = 0; -char history_expansion_char = '!'; -char history_subst_char = '^'; -char *history_no_expand_chars = expand_chars; -Function *history_inhibit_expansion_function = NULL; -char *history_arg_extract(int start, int end, const char *str); - -int rl_inhibit_completion = 0; -int rl_attempted_completion_over = 0; -char *rl_basic_word_break_characters = break_chars; -char *rl_completer_word_break_characters = NULL; -char *rl_completer_quote_characters = NULL; -Function *rl_completion_entry_function = NULL; -CPPFunction *rl_attempted_completion_function = NULL; -Function *rl_pre_input_hook = NULL; -Function *rl_startup1_hook = NULL; -int (*rl_getc_function)(FILE *) = NULL; -char *rl_terminal_name = NULL; -int rl_already_prompted = 0; -int rl_filename_completion_desired = 0; -int rl_ignore_completion_duplicates = 0; -int rl_catch_signals = 1; -int readline_echoing_p = 1; -int _rl_print_completions_horizontally = 0; -VFunction *rl_redisplay_function = NULL; -Function *rl_startup_hook = NULL; -VFunction *rl_completion_display_matches_hook = NULL; -VFunction *rl_prep_term_function = (VFunction *)rl_prep_terminal; -VFunction *rl_deprep_term_function = (VFunction *)rl_deprep_terminal; -KEYMAP_ENTRY_ARRAY emacs_meta_keymap; - -/* - * The current prompt string. - */ -char *rl_prompt = NULL; -/* - * This is set to character indicating type of completion being done by - * rl_complete_internal(); this is available for application completion - * functions. - */ -int rl_completion_type = 0; - -/* - * If more than this number of items results from query for possible - * completions, we ask user if they are sure to really display the list. - */ -int rl_completion_query_items = 100; - -/* - * List of characters which are word break characters, but should be left - * in the parsed text when it is passed to the completion function. - * Shell uses this to help determine what kind of completing to do. - */ -char *rl_special_prefixes = NULL; - -/* - * This is the character appended to the completed words if at the end of - * the line. Default is ' ' (a space). - */ -int rl_completion_append_character = ' '; - -/* stuff below is used internally by libedit for readline emulation */ - -static History *h = NULL; -static EditLine *e = NULL; -static Function *map[256]; -static jmp_buf topbuf; - -/* internal functions */ -static unsigned char _el_rl_complete(EditLine *, int); -static unsigned char _el_rl_tstp(EditLine *, int); -static char *_get_prompt(EditLine *); -static int _getc_function(EditLine *, char *); -static HIST_ENTRY *_move_history(int); -static int _history_expand_command(const char *, size_t, size_t, - char **); -static char *_rl_compat_sub(const char *, const char *, - const char *, int); -static int _rl_event_read_char(EditLine *, char *); -static void _rl_update_pos(void); - - -/* ARGSUSED */ -static char * -_get_prompt(EditLine *el __attribute__((__unused__))) -{ - rl_already_prompted = 1; - return rl_prompt; -} - - -/* - * generic function for moving around history - */ -static HIST_ENTRY * -_move_history(int op) -{ - HistEvent ev; - static HIST_ENTRY rl_he; - - if (history(h, &ev, op) != 0) - return NULL; - - rl_he.line = ev.str; - rl_he.data = NULL; - - return &rl_he; -} - - -/* - * read one key from user defined input function - */ -static int -/*ARGSUSED*/ -_getc_function(EditLine *el __attribute__((__unused__)), char *c) -{ - int i; - - i = (*rl_getc_function)(NULL); - if (i == -1) - return 0; - *c = (char)i; - return 1; -} - -static void -_resize_fun(EditLine *el, void *a) -{ - const LineInfo *li; - char **ap = a; - - li = el_line(el); - /* a cheesy way to get rid of const cast. */ - *ap = memchr(li->buffer, *li->buffer, (size_t)1); -} - -static const char * -_default_history_file(void) -{ - struct passwd *p; - static char path[PATH_MAX]; - - if (*path) - return path; - if ((p = getpwuid(getuid())) == NULL) - return NULL; - (void)snprintf(path, sizeof(path), "%s/.history", p->pw_dir); - return path; -} - -/* - * READLINE compatibility stuff - */ - -/* - * Set the prompt - */ -int -rl_set_prompt(const char *prompt) -{ - char *p; - - if (!prompt) - prompt = ""; - if (rl_prompt != NULL && strcmp(rl_prompt, prompt) == 0) - return 0; - if (rl_prompt) - el_free(rl_prompt); - rl_prompt = strdup(prompt); - if (rl_prompt == NULL) - return -1; - - while ((p = strchr(rl_prompt, RL_PROMPT_END_IGNORE)) != NULL) - *p = RL_PROMPT_START_IGNORE; - - return 0; -} - -/* - * initialize rl compat stuff - */ -int -rl_initialize(void) -{ - HistEvent ev; - int editmode = 1; - struct termios t; - - if (e != NULL) - el_end(e); - if (h != NULL) - history_end(h); - - if (!rl_instream) - rl_instream = stdin; - if (!rl_outstream) - rl_outstream = stdout; - - /* - * See if we don't really want to run the editor - */ - if (tcgetattr(fileno(rl_instream), &t) != -1 && (t.c_lflag & ECHO) == 0) - editmode = 0; - - e = el_init(rl_readline_name, rl_instream, rl_outstream, stderr); - - if (!editmode) - el_set(e, EL_EDITMODE, 0); - - h = history_init(); - if (!e || !h) - return -1; - - history(h, &ev, H_SETSIZE, INT_MAX); /* unlimited */ - history_length = 0; - max_input_history = INT_MAX; - el_set(e, EL_HIST, history, h); - - /* Setup resize function */ - el_set(e, EL_RESIZE, _resize_fun, &rl_line_buffer); - - /* setup getc function if valid */ - if (rl_getc_function) - el_set(e, EL_GETCFN, _getc_function); - - /* for proper prompt printing in readline() */ - if (rl_set_prompt("") == -1) { - history_end(h); - el_end(e); - return -1; - } - el_set(e, EL_PROMPT, _get_prompt, RL_PROMPT_START_IGNORE); - el_set(e, EL_SIGNAL, rl_catch_signals); - - /* set default mode to "emacs"-style and read setting afterwards */ - /* so this can be overriden */ - el_set(e, EL_EDITOR, "emacs"); - if (rl_terminal_name != NULL) - el_set(e, EL_TERMINAL, rl_terminal_name); - else - el_get(e, EL_TERMINAL, &rl_terminal_name); - - /* - * Word completion - this has to go AFTER rebinding keys - * to emacs-style. - */ - el_set(e, EL_ADDFN, "rl_complete", - "ReadLine compatible completion function", - _el_rl_complete); - el_set(e, EL_BIND, "^I", "rl_complete", NULL); - - /* - * Send TSTP when ^Z is pressed. - */ - el_set(e, EL_ADDFN, "rl_tstp", - "ReadLine compatible suspend function", - _el_rl_tstp); - el_set(e, EL_BIND, "^Z", "rl_tstp", NULL); - - /* - * Set some readline compatible key-bindings. - */ - el_set(e, EL_BIND, "^R", "em-inc-search-prev", NULL); - - /* - * Allow the use of Home/End keys. - */ - el_set(e, EL_BIND, "\\e[1~", "ed-move-to-beg", NULL); - el_set(e, EL_BIND, "\\e[4~", "ed-move-to-end", NULL); - el_set(e, EL_BIND, "\\e[7~", "ed-move-to-beg", NULL); - el_set(e, EL_BIND, "\\e[8~", "ed-move-to-end", NULL); - el_set(e, EL_BIND, "\\e[H", "ed-move-to-beg", NULL); - el_set(e, EL_BIND, "\\e[F", "ed-move-to-end", NULL); - - /* - * Allow the use of the Delete/Insert keys. - */ - el_set(e, EL_BIND, "\\e[3~", "ed-delete-next-char", NULL); - el_set(e, EL_BIND, "\\e[2~", "ed-quoted-insert", NULL); - - /* - * Ctrl-left-arrow and Ctrl-right-arrow for word moving. - */ - el_set(e, EL_BIND, "\\e[1;5C", "em-next-word", NULL); - el_set(e, EL_BIND, "\\e[1;5D", "ed-prev-word", NULL); - el_set(e, EL_BIND, "\\e[5C", "em-next-word", NULL); - el_set(e, EL_BIND, "\\e[5D", "ed-prev-word", NULL); - el_set(e, EL_BIND, "\\e\\e[C", "em-next-word", NULL); - el_set(e, EL_BIND, "\\e\\e[D", "ed-prev-word", NULL); - - /* read settings from configuration file */ - el_source(e, NULL); - - /* - * Unfortunately, some applications really do use rl_point - * and rl_line_buffer directly. - */ - _resize_fun(e, &rl_line_buffer); - _rl_update_pos(); - - if (rl_startup_hook) - (*rl_startup_hook)(NULL, 0); - - return 0; -} - - -/* - * read one line from input stream and return it, chomping - * trailing newline (if there is any) - */ -char * -readline(const char *p) -{ - HistEvent ev; - const char * volatile prompt = p; - int count; - const char *ret; - char *buf; - static int used_event_hook; - - if (e == NULL || h == NULL) - rl_initialize(); - - rl_done = 0; - - (void)setjmp(topbuf); - - /* update prompt accordingly to what has been passed */ - if (rl_set_prompt(prompt) == -1) - return NULL; - - if (rl_pre_input_hook) - (*rl_pre_input_hook)(NULL, 0); - - if (rl_event_hook && !(e->el_flags&NO_TTY)) { - el_set(e, EL_GETCFN, _rl_event_read_char); - used_event_hook = 1; - } - - if (!rl_event_hook && used_event_hook) { - el_set(e, EL_GETCFN, EL_BUILTIN_GETCFN); - used_event_hook = 0; - } - - rl_already_prompted = 0; - - /* get one line from input stream */ - ret = el_gets(e, &count); - - if (ret && count > 0) { - int lastidx; - - buf = strdup(ret); - if (buf == NULL) - return NULL; - lastidx = count - 1; - if (buf[lastidx] == '\n') - buf[lastidx] = '\0'; - } else - buf = NULL; - - history(h, &ev, H_GETSIZE); - history_length = ev.num; - - return buf; -} - -/* - * history functions - */ - -/* - * is normally called before application starts to use - * history expansion functions - */ -void -using_history(void) -{ - if (h == NULL || e == NULL) - rl_initialize(); -} - - -/* - * substitute ``what'' with ``with'', returning resulting string; if - * globally == 1, substitutes all occurrences of what, otherwise only the - * first one - */ -static char * -_rl_compat_sub(const char *str, const char *what, const char *with, - int globally) -{ - const char *s; - char *r, *result; - size_t len, with_len, what_len; - - len = strlen(str); - with_len = strlen(with); - what_len = strlen(what); - - /* calculate length we need for result */ - s = str; - while (*s) { - if (*s == *what && !strncmp(s, what, what_len)) { - len += with_len - what_len; - if (!globally) - break; - s += what_len; - } else - s++; - } - r = result = el_malloc((len + 1) * sizeof(*r)); - if (result == NULL) - return NULL; - s = str; - while (*s) { - if (*s == *what && !strncmp(s, what, what_len)) { - (void)strncpy(r, with, with_len); - r += with_len; - s += what_len; - if (!globally) { - (void)strcpy(r, s); - return result; - } - } else - *r++ = *s++; - } - *r = '\0'; - return result; -} - -static char *last_search_pat; /* last !?pat[?] search pattern */ -static char *last_search_match; /* last !?pat[?] that matched */ - -const char * -get_history_event(const char *cmd, int *cindex, int qchar) -{ - int idx, sign, sub, num, begin, ret; - size_t len; - char *pat; - const char *rptr; - HistEvent ev; - - idx = *cindex; - if (cmd[idx++] != history_expansion_char) - return NULL; - - /* find out which event to take */ - if (cmd[idx] == history_expansion_char || cmd[idx] == '\0') { - if (history(h, &ev, H_FIRST) != 0) - return NULL; - *cindex = cmd[idx]? (idx + 1):idx; - return ev.str; - } - sign = 0; - if (cmd[idx] == '-') { - sign = 1; - idx++; - } - - if ('0' <= cmd[idx] && cmd[idx] <= '9') { - HIST_ENTRY *rl_he; - - num = 0; - while (cmd[idx] && '0' <= cmd[idx] && cmd[idx] <= '9') { - num = num * 10 + cmd[idx] - '0'; - idx++; - } - if (sign) - num = history_length - num + 1; - - if (!(rl_he = history_get(num))) - return NULL; - - *cindex = idx; - return rl_he->line; - } - sub = 0; - if (cmd[idx] == '?') { - sub = 1; - idx++; - } - begin = idx; - while (cmd[idx]) { - if (cmd[idx] == '\n') - break; - if (sub && cmd[idx] == '?') - break; - if (!sub && (cmd[idx] == ':' || cmd[idx] == ' ' - || cmd[idx] == '\t' || cmd[idx] == qchar)) - break; - idx++; - } - len = (size_t)idx - (size_t)begin; - if (sub && cmd[idx] == '?') - idx++; - if (sub && len == 0 && last_search_pat && *last_search_pat) - pat = last_search_pat; - else if (len == 0) - return NULL; - else { - if ((pat = el_malloc((len + 1) * sizeof(*pat))) == NULL) - return NULL; - (void)strncpy(pat, cmd + begin, len); - pat[len] = '\0'; - } - - if (history(h, &ev, H_CURR) != 0) { - if (pat != last_search_pat) - el_free(pat); - return NULL; - } - num = ev.num; - - if (sub) { - if (pat != last_search_pat) { - if (last_search_pat) - el_free(last_search_pat); - last_search_pat = pat; - } - ret = history_search(pat, -1); - } else - ret = history_search_prefix(pat, -1); - - if (ret == -1) { - /* restore to end of list on failed search */ - history(h, &ev, H_FIRST); - (void)fprintf(rl_outstream, "%s: Event not found\n", pat); - if (pat != last_search_pat) - el_free(pat); - return NULL; - } - - if (sub && len) { - if (last_search_match && last_search_match != pat) - el_free(last_search_match); - last_search_match = pat; - } - - if (pat != last_search_pat) - el_free(pat); - - if (history(h, &ev, H_CURR) != 0) - return NULL; - *cindex = idx; - rptr = ev.str; - - /* roll back to original position */ - (void)history(h, &ev, H_SET, num); - - return rptr; -} - -/* - * the real function doing history expansion - takes as argument command - * to do and data upon which the command should be executed - * does expansion the way I've understood readline documentation - * - * returns 0 if data was not modified, 1 if it was and 2 if the string - * should be only printed and not executed; in case of error, - * returns -1 and *result points to NULL - * it's callers responsibility to free() string returned in *result - */ -static int -_history_expand_command(const char *command, size_t offs, size_t cmdlen, - char **result) -{ - char *tmp, *search = NULL, *aptr; - const char *ptr, *cmd; - static char *from = NULL, *to = NULL; - int start, end, idx, has_mods = 0; - int p_on = 0, g_on = 0; - - *result = NULL; - aptr = NULL; - ptr = NULL; - - /* First get event specifier */ - idx = 0; - - if (strchr(":^*$", command[offs + 1])) { - char str[4]; - /* - * "!:" is shorthand for "!!:". - * "!^", "!*" and "!$" are shorthand for - * "!!:^", "!!:*" and "!!:$" respectively. - */ - str[0] = str[1] = '!'; - str[2] = '0'; - ptr = get_history_event(str, &idx, 0); - idx = (command[offs + 1] == ':')? 1:0; - has_mods = 1; - } else { - if (command[offs + 1] == '#') { - /* use command so far */ - if ((aptr = el_malloc((offs + 1) * sizeof(*aptr))) - == NULL) - return -1; - (void)strncpy(aptr, command, offs); - aptr[offs] = '\0'; - idx = 1; - } else { - int qchar; - - qchar = (offs > 0 && command[offs - 1] == '"')? '"':0; - ptr = get_history_event(command + offs, &idx, qchar); - } - has_mods = command[offs + (size_t)idx] == ':'; - } - - if (ptr == NULL && aptr == NULL) - return -1; - - if (!has_mods) { - *result = strdup(aptr ? aptr : ptr); - if (aptr) - el_free(aptr); - if (*result == NULL) - return -1; - return 1; - } - - cmd = command + offs + idx + 1; - - /* Now parse any word designators */ - - if (*cmd == '%') /* last word matched by ?pat? */ - tmp = strdup(last_search_match? last_search_match:""); - else if (strchr("^*$-0123456789", *cmd)) { - start = end = -1; - if (*cmd == '^') - start = end = 1, cmd++; - else if (*cmd == '$') - start = -1, cmd++; - else if (*cmd == '*') - start = 1, cmd++; - else if (*cmd == '-' || isdigit((unsigned char) *cmd)) { - start = 0; - while (*cmd && '0' <= *cmd && *cmd <= '9') - start = start * 10 + *cmd++ - '0'; - - if (*cmd == '-') { - if (isdigit((unsigned char) cmd[1])) { - cmd++; - end = 0; - while (*cmd && '0' <= *cmd && *cmd <= '9') - end = end * 10 + *cmd++ - '0'; - } else if (cmd[1] == '$') { - cmd += 2; - end = -1; - } else { - cmd++; - end = -2; - } - } else if (*cmd == '*') - end = -1, cmd++; - else - end = start; - } - tmp = history_arg_extract(start, end, aptr? aptr:ptr); - if (tmp == NULL) { - (void)fprintf(rl_outstream, "%s: Bad word specifier", - command + offs + idx); - if (aptr) - el_free(aptr); - return -1; - } - } else - tmp = strdup(aptr? aptr:ptr); - - if (aptr) - el_free(aptr); - - if (*cmd == '\0' || ((size_t)(cmd - (command + offs)) >= cmdlen)) { - *result = tmp; - return 1; - } - - for (; *cmd; cmd++) { - if (*cmd == ':') - continue; - else if (*cmd == 'h') { /* remove trailing path */ - if ((aptr = strrchr(tmp, '/')) != NULL) - *aptr = '\0'; - } else if (*cmd == 't') { /* remove leading path */ - if ((aptr = strrchr(tmp, '/')) != NULL) { - aptr = strdup(aptr + 1); - el_free(tmp); - tmp = aptr; - } - } else if (*cmd == 'r') { /* remove trailing suffix */ - if ((aptr = strrchr(tmp, '.')) != NULL) - *aptr = '\0'; - } else if (*cmd == 'e') { /* remove all but suffix */ - if ((aptr = strrchr(tmp, '.')) != NULL) { - aptr = strdup(aptr); - el_free(tmp); - tmp = aptr; - } - } else if (*cmd == 'p') /* print only */ - p_on = 1; - else if (*cmd == 'g') - g_on = 2; - else if (*cmd == 's' || *cmd == '&') { - char *what, *with, delim; - size_t len, from_len; - size_t size; - - if (*cmd == '&' && (from == NULL || to == NULL)) - continue; - else if (*cmd == 's') { - delim = *(++cmd), cmd++; - size = 16; - what = el_realloc(from, size * sizeof(*what)); - if (what == NULL) { - el_free(from); - el_free(tmp); - return 0; - } - len = 0; - for (; *cmd && *cmd != delim; cmd++) { - if (*cmd == '\\' && cmd[1] == delim) - cmd++; - if (len >= size) { - char *nwhat; - nwhat = el_realloc(what, - (size <<= 1) * - sizeof(*nwhat)); - if (nwhat == NULL) { - el_free(what); - el_free(tmp); - return 0; - } - what = nwhat; - } - what[len++] = *cmd; - } - what[len] = '\0'; - from = what; - if (*what == '\0') { - el_free(what); - if (search) { - from = strdup(search); - if (from == NULL) { - el_free(tmp); - return 0; - } - } else { - from = NULL; - el_free(tmp); - return -1; - } - } - cmd++; /* shift after delim */ - if (!*cmd) - continue; - - size = 16; - with = el_realloc(to, size * sizeof(*with)); - if (with == NULL) { - el_free(to); - el_free(tmp); - 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; - nwith = el_realloc(with, - size * sizeof(*nwith)); - if (nwith == NULL) { - el_free(with); - el_free(tmp); - return -1; - } - with = nwith; - } - if (*cmd == '&') { - /* safe */ - (void)strcpy(&with[len], from); - len += from_len; - continue; - } - if (*cmd == '\\' - && (*(cmd + 1) == delim - || *(cmd + 1) == '&')) - cmd++; - with[len++] = *cmd; - } - with[len] = '\0'; - to = with; - } - - aptr = _rl_compat_sub(tmp, from, to, g_on); - if (aptr) { - el_free(tmp); - tmp = aptr; - } - g_on = 0; - } - } - *result = tmp; - return p_on? 2:1; -} - - -/* - * csh-style history expansion - */ -int -history_expand(char *str, char **output) -{ - int ret = 0; - size_t idx, i, size; - char *tmp, *result; - - if (h == NULL || e == NULL) - rl_initialize(); - - if (history_expansion_char == 0) { - *output = strdup(str); - return 0; - } - - *output = NULL; - if (str[0] == history_subst_char) { - /* ^foo^foo2^ is equivalent to !!:s^foo^foo2^ */ - *output = el_malloc((strlen(str) + 4 + 1) * sizeof(*output)); - if (*output == NULL) - return 0; - (*output)[0] = (*output)[1] = history_expansion_char; - (*output)[2] = ':'; - (*output)[3] = 's'; - (void)strcpy((*output) + 4, str); - str = *output; - } else { - *output = strdup(str); - if (*output == NULL) - return 0; - } - -#define ADD_STRING(what, len, fr) \ - { \ - if (idx + len + 1 > size) { \ - char *nresult = el_realloc(result, \ - (size += len + 1) * sizeof(*nresult)); \ - if (nresult == NULL) { \ - el_free(*output); \ - if (/*CONSTCOND*/fr) \ - el_free(tmp); \ - return 0; \ - } \ - result = nresult; \ - } \ - (void)strncpy(&result[idx], what, len); \ - idx += len; \ - result[idx] = '\0'; \ - } - - result = NULL; - size = idx = 0; - tmp = NULL; - for (i = 0; str[i];) { - int qchar, loop_again; - size_t len, start, j; - - qchar = 0; - loop_again = 1; - start = j = i; -loop: - for (; str[j]; j++) { - if (str[j] == '\\' && - str[j + 1] == history_expansion_char) { - (void)strcpy(&str[j], &str[j + 1]); - continue; - } - if (!loop_again) { - if (isspace((unsigned char) str[j]) - || str[j] == qchar) - break; - } - if (str[j] == history_expansion_char - && !strchr(history_no_expand_chars, str[j + 1]) - && (!history_inhibit_expansion_function || - (*history_inhibit_expansion_function)(str, - (int)j) == 0)) - break; - } - - if (str[j] && loop_again) { - i = j; - qchar = (j > 0 && str[j - 1] == '"' )? '"':0; - j++; - if (str[j] == history_expansion_char) - j++; - loop_again = 0; - goto loop; - } - len = i - start; - ADD_STRING(&str[start], len, 0); - - if (str[i] == '\0' || str[i] != history_expansion_char) { - len = j - i; - ADD_STRING(&str[i], len, 0); - if (start == 0) - ret = 0; - else - ret = 1; - break; - } - ret = _history_expand_command (str, i, (j - i), &tmp); - if (ret > 0 && tmp) { - len = strlen(tmp); - ADD_STRING(tmp, len, 1); - } - if (tmp) { - el_free(tmp); - tmp = NULL; - } - i = j; - } - - /* ret is 2 for "print only" option */ - if (ret == 2) { - add_history(result); -#ifdef GDB_411_HACK - /* gdb 4.11 has been shipped with readline, where */ - /* history_expand() returned -1 when the line */ - /* should not be executed; in readline 2.1+ */ - /* it should return 2 in such a case */ - ret = -1; -#endif - } - el_free(*output); - *output = result; - - return ret; -} - -/* -* Return a string consisting of arguments of "str" from "start" to "end". -*/ -char * -history_arg_extract(int start, int end, const char *str) -{ - size_t i, len, max; - char **arr, *result = NULL; - - arr = history_tokenize(str); - if (!arr) - return NULL; - if (arr && *arr == NULL) - goto out; - - for (max = 0; arr[max]; max++) - continue; - max--; - - if (start == '$') - start = (int)max; - if (end == '$') - end = (int)max; - if (end < 0) - end = (int)max + end + 1; - if (start < 0) - start = end; - - if (start < 0 || end < 0 || (size_t)start > max || - (size_t)end > max || start > end) - goto out; - - for (i = (size_t)start, len = 0; i <= (size_t)end; i++) - len += strlen(arr[i]) + 1; - len++; - result = el_malloc(len * sizeof(*result)); - if (result == NULL) - goto out; - - for (i = (size_t)start, len = 0; i <= (size_t)end; i++) { - (void)strcpy(result + len, arr[i]); - len += strlen(arr[i]); - if (i < (size_t)end) - result[len++] = ' '; - } - result[len] = '\0'; - -out: - for (i = 0; arr[i]; i++) - el_free(arr[i]); - el_free(arr); - - return result; -} - -/* - * Parse the string into individual tokens, - * similar to how shell would do it. - */ -char ** -history_tokenize(const char *str) -{ - int size = 1, idx = 0, i, start; - size_t len; - char **result = NULL, *temp, delim = '\0'; - - for (i = 0; str[i];) { - while (isspace((unsigned char) str[i])) - i++; - start = i; - for (; str[i];) { - if (str[i] == '\\') { - if (str[i+1] != '\0') - i++; - } else if (str[i] == delim) - delim = '\0'; - else if (!delim && - (isspace((unsigned char) str[i]) || - strchr("()<>;&|$", str[i]))) - break; - else if (!delim && strchr("'`\"", str[i])) - delim = str[i]; - if (str[i]) - i++; - } - - if (idx + 2 >= size) { - char **nresult; - size <<= 1; - nresult = el_realloc(result, (size_t)size * sizeof(*nresult)); - if (nresult == NULL) { - el_free(result); - return NULL; - } - result = nresult; - } - len = (size_t)i - (size_t)start; - temp = el_malloc((size_t)(len + 1) * sizeof(*temp)); - if (temp == NULL) { - for (i = 0; i < idx; i++) - el_free(result[i]); - el_free(result); - return NULL; - } - (void)strncpy(temp, &str[start], len); - temp[len] = '\0'; - result[idx++] = temp; - result[idx] = NULL; - if (str[i]) - i++; - } - return result; -} - - -/* - * limit size of history record to ``max'' events - */ -void -stifle_history(int max) -{ - HistEvent ev; - - if (h == NULL || e == NULL) - rl_initialize(); - - if (history(h, &ev, H_SETSIZE, max) == 0) - max_input_history = max; -} - - -/* - * "unlimit" size of history - set the limit to maximum allowed int value - */ -int -unstifle_history(void) -{ - HistEvent ev; - int omax; - - history(h, &ev, H_SETSIZE, INT_MAX); - omax = max_input_history; - max_input_history = INT_MAX; - return omax; /* some value _must_ be returned */ -} - - -int -history_is_stifled(void) -{ - - /* cannot return true answer */ - return max_input_history != INT_MAX; -} - -static const char _history_tmp_template[] = "/tmp/.historyXXXXXX"; - -int -history_truncate_file (const char *filename, int nlines) -{ - int ret = 0; - FILE *fp, *tp; - char template[sizeof(_history_tmp_template)]; - char buf[4096]; - int fd; - char *cp; - off_t off; - int count = 0; - ssize_t left = 0; - - if (filename == NULL && (filename = _default_history_file()) == NULL) - return errno; - if ((fp = fopen(filename, "r+")) == NULL) - return errno; - strcpy(template, _history_tmp_template); - if ((fd = mkstemp(template)) == -1) { - ret = errno; - goto out1; - } - - if ((tp = fdopen(fd, "r+")) == NULL) { - close(fd); - ret = errno; - goto out2; - } - - for(;;) { - if (fread(buf, sizeof(buf), (size_t)1, fp) != 1) { - if (ferror(fp)) { - ret = errno; - break; - } - if (fseeko(fp, (off_t)sizeof(buf) * count, SEEK_SET) == - (off_t)-1) { - ret = errno; - break; - } - left = (ssize_t)fread(buf, (size_t)1, sizeof(buf), fp); - if (ferror(fp)) { - ret = errno; - break; - } - if (left == 0) { - count--; - left = sizeof(buf); - } else if (fwrite(buf, (size_t)left, (size_t)1, tp) - != 1) { - ret = errno; - break; - } - fflush(tp); - break; - } - if (fwrite(buf, sizeof(buf), (size_t)1, tp) != 1) { - ret = errno; - break; - } - count++; - } - if (ret) - goto out3; - cp = buf + left - 1; - if(*cp != '\n') - cp++; - for(;;) { - while (--cp >= buf) { - if (*cp == '\n') { - if (--nlines == 0) { - if (++cp >= buf + sizeof(buf)) { - count++; - cp = buf; - } - break; - } - } - } - if (nlines <= 0 || count == 0) - break; - count--; - if (fseeko(tp, (off_t)sizeof(buf) * count, SEEK_SET) < 0) { - ret = errno; - break; - } - if (fread(buf, sizeof(buf), (size_t)1, tp) != 1) { - if (ferror(tp)) { - ret = errno; - break; - } - ret = EAGAIN; - break; - } - cp = buf + sizeof(buf); - } - - if (ret || nlines > 0) - goto out3; - - if (fseeko(fp, (off_t)0, SEEK_SET) == (off_t)-1) { - ret = errno; - goto out3; - } - - if (fseeko(tp, (off_t)sizeof(buf) * count + (cp - buf), SEEK_SET) == - (off_t)-1) { - ret = errno; - goto out3; - } - - for(;;) { - if ((left = (ssize_t)fread(buf, (size_t)1, sizeof(buf), tp)) == 0) { - if (ferror(fp)) - ret = errno; - break; - } - if (fwrite(buf, (size_t)left, (size_t)1, fp) != 1) { - ret = errno; - break; - } - } - fflush(fp); - if((off = ftello(fp)) > 0) { - if (ftruncate(fileno(fp), off) == -1) - ret = errno; - } -out3: - fclose(tp); -out2: - unlink(template); -out1: - fclose(fp); - - return ret; -} - - -/* - * read history from a file given - */ -int -read_history(const char *filename) -{ - HistEvent ev; - - if (h == NULL || e == NULL) - rl_initialize(); - if (filename == NULL && (filename = _default_history_file()) == NULL) - return errno; - return history(h, &ev, H_LOAD, filename) == -1 ? - (errno ? errno : EINVAL) : 0; -} - - -/* - * write history to a file given - */ -int -write_history(const char *filename) -{ - HistEvent ev; - - if (h == NULL || e == NULL) - rl_initialize(); - if (filename == NULL && (filename = _default_history_file()) == NULL) - return errno; - return history(h, &ev, H_SAVE, filename) == -1 ? - (errno ? errno : EINVAL) : 0; -} - - -/* - * returns history ``num''th event - * - * returned pointer points to static variable - */ -HIST_ENTRY * -history_get(int num) -{ - static HIST_ENTRY she; - HistEvent ev; - int curr_num; - - if (h == NULL || e == NULL) - rl_initialize(); - - /* save current position */ - if (history(h, &ev, H_CURR) != 0) - return NULL; - curr_num = ev.num; - - /* start from the oldest */ - if (history(h, &ev, H_LAST) != 0) - return NULL; /* error */ - - /* look forwards for event matching specified offset */ - if (history(h, &ev, H_NEXT_EVDATA, num, &she.data)) - return NULL; - - she.line = ev.str; - - /* restore pointer to where it was */ - (void)history(h, &ev, H_SET, curr_num); - - return &she; -} - - -/* - * add the line to history table - */ -int -add_history(const char *line) -{ - HistEvent ev; - - if (h == NULL || e == NULL) - rl_initialize(); - - (void)history(h, &ev, H_ENTER, line); - if (history(h, &ev, H_GETSIZE) == 0) - history_length = ev.num; - - return !(history_length > 0); /* return 0 if all is okay */ -} - - -/* - * remove the specified entry from the history list and return it. - */ -HIST_ENTRY * -remove_history(int num) -{ - HIST_ENTRY *he; - HistEvent ev; - - if (h == NULL || e == NULL) - rl_initialize(); - - if ((he = el_malloc(sizeof(*he))) == NULL) - return NULL; - - if (history(h, &ev, H_DELDATA, num, &he->data) != 0) { - el_free(he); - return NULL; - } - - he->line = ev.str; - if (history(h, &ev, H_GETSIZE) == 0) - history_length = ev.num; - - return he; -} - - -/* - * replace the line and data of the num-th entry - */ -HIST_ENTRY * -replace_history_entry(int num, const char *line, histdata_t data) -{ - HIST_ENTRY *he; - HistEvent ev; - int curr_num; - - if (h == NULL || e == NULL) - rl_initialize(); - - /* save current position */ - if (history(h, &ev, H_CURR) != 0) - return NULL; - curr_num = ev.num; - - /* start from the oldest */ - if (history(h, &ev, H_LAST) != 0) - return NULL; /* error */ - - if ((he = el_malloc(sizeof(*he))) == NULL) - return NULL; - - /* look forwards for event matching specified offset */ - if (history(h, &ev, H_NEXT_EVDATA, num, &he->data)) - goto out; - - he->line = strdup(ev.str); - if (he->line == NULL) - goto out; - - if (history(h, &ev, H_REPLACE, line, data)) - goto out; - - /* restore pointer to where it was */ - if (history(h, &ev, H_SET, curr_num)) - goto out; - - return he; -out: - el_free(he); - return NULL; -} - -/* - * clear the history list - delete all entries - */ -void -clear_history(void) -{ - HistEvent ev; - - (void)history(h, &ev, H_CLEAR); - history_length = 0; -} - - -/* - * returns offset of the current history event - */ -int -where_history(void) -{ - HistEvent ev; - int curr_num, off; - - if (history(h, &ev, H_CURR) != 0) - return 0; - curr_num = ev.num; - - (void)history(h, &ev, H_FIRST); - off = 1; - while (ev.num != curr_num && history(h, &ev, H_NEXT) == 0) - off++; - - return off; -} - - -/* - * returns current history event or NULL if there is no such event - */ -HIST_ENTRY * -current_history(void) -{ - - return _move_history(H_CURR); -} - - -/* - * returns total number of bytes history events' data are using - */ -int -history_total_bytes(void) -{ - HistEvent ev; - int curr_num; - size_t size; - - if (history(h, &ev, H_CURR) != 0) - return -1; - curr_num = ev.num; - - (void)history(h, &ev, H_FIRST); - size = 0; - do - size += strlen(ev.str) * sizeof(*ev.str); - while (history(h, &ev, H_NEXT) == 0); - - /* get to the same position as before */ - history(h, &ev, H_PREV_EVENT, curr_num); - - return (int)size; -} - - -/* - * sets the position in the history list to ``pos'' - */ -int -history_set_pos(int pos) -{ - HistEvent ev; - int curr_num; - - if (pos >= history_length || pos < 0) - return -1; - - (void)history(h, &ev, H_CURR); - curr_num = ev.num; - - /* - * use H_DELDATA to set to nth history (without delete) by passing - * (void **)-1 - */ - if (history(h, &ev, H_DELDATA, pos, (void **)-1)) { - (void)history(h, &ev, H_SET, curr_num); - return -1; - } - return 0; -} - - -/* - * returns previous event in history and shifts pointer accordingly - */ -HIST_ENTRY * -previous_history(void) -{ - - return _move_history(H_PREV); -} - - -/* - * returns next event in history and shifts pointer accordingly - */ -HIST_ENTRY * -next_history(void) -{ - - return _move_history(H_NEXT); -} - - -/* - * searches for first history event containing the str - */ -int -history_search(const char *str, int direction) -{ - HistEvent ev; - const char *strp; - int curr_num; - - if (history(h, &ev, H_CURR) != 0) - return -1; - curr_num = ev.num; - - for (;;) { - if ((strp = strstr(ev.str, str)) != NULL) - return (int)(strp - ev.str); - if (history(h, &ev, direction < 0 ? H_NEXT:H_PREV) != 0) - break; - } - (void)history(h, &ev, H_SET, curr_num); - return -1; -} - - -/* - * searches for first history event beginning with str - */ -int -history_search_prefix(const char *str, int direction) -{ - HistEvent ev; - - return (history(h, &ev, direction < 0 ? - H_PREV_STR : H_NEXT_STR, str)); -} - - -/* - * search for event in history containing str, starting at offset - * abs(pos); continue backward, if pos<0, forward otherwise - */ -/* ARGSUSED */ -int -history_search_pos(const char *str, - int direction __attribute__((__unused__)), int pos) -{ - HistEvent ev; - int curr_num, off; - - off = (pos > 0) ? pos : -pos; - pos = (pos > 0) ? 1 : -1; - - if (history(h, &ev, H_CURR) != 0) - return -1; - curr_num = ev.num; - - if (history_set_pos(off) != 0 || history(h, &ev, H_CURR) != 0) - return -1; - - for (;;) { - if (strstr(ev.str, str)) - return off; - if (history(h, &ev, (pos < 0) ? H_PREV : H_NEXT) != 0) - break; - } - - /* set "current" pointer back to previous state */ - (void)history(h, &ev, - pos < 0 ? H_NEXT_EVENT : H_PREV_EVENT, curr_num); - - return -1; -} - - -/********************************/ -/* completion functions */ - -char * -tilde_expand(char *name) -{ - return fn_tilde_expand(name); -} - -char * -filename_completion_function(const char *name, int state) -{ - return fn_filename_completion_function(name, state); -} - -/* - * a completion generator for usernames; returns _first_ username - * which starts with supplied text - * text contains a partial username preceded by random character - * (usually '~'); state resets search from start (??? should we do that anyway) - * it's callers responsibility to free returned value - */ -char * -username_completion_function(const char *text, int state) -{ -#if defined(HAVE_GETPW_R_POSIX) || defined(HAVE_GETPW_R_DRAFT) - struct passwd pwres; - char pwbuf[1024]; -#endif - struct passwd *pass = NULL; - - if (text[0] == '\0') - return NULL; - - if (*text == '~') - text++; - - if (state == 0) - setpwent(); - - while ( -#if defined(HAVE_GETPW_R_POSIX) || defined(HAVE_GETPW_R_DRAFT) - getpwent_r(&pwres, pwbuf, sizeof(pwbuf), &pass) == 0 && pass != NULL -#else - (pass = getpwent()) != NULL -#endif - && text[0] == pass->pw_name[0] - && strcmp(text, pass->pw_name) == 0) - continue; - - if (pass == NULL) { - endpwent(); - return NULL; - } - return strdup(pass->pw_name); -} - - -/* - * el-compatible wrapper to send TSTP on ^Z - */ -/* ARGSUSED */ -static unsigned char -_el_rl_tstp(EditLine *el __attribute__((__unused__)), int ch __attribute__((__unused__))) -{ - (void)kill(0, SIGTSTP); - return CC_NORM; -} - -/* - * Display list of strings in columnar format on readline's output stream. - * 'matches' is list of strings, 'len' is number of strings in 'matches', - * 'max' is maximum length of string in 'matches'. - */ -void -rl_display_match_list(char **matches, int len, int max) -{ - - fn_display_match_list(e, matches, (size_t)len, (size_t)max); -} - -static const char * -/*ARGSUSED*/ -_rl_completion_append_character_function(const char *dummy - __attribute__((__unused__))) -{ - static char buf[2]; - buf[0] = (char)rl_completion_append_character; - buf[1] = '\0'; - return buf; -} - - -/* - * complete word at current point - */ -/* ARGSUSED */ -int -rl_complete(int ignore __attribute__((__unused__)), int invoking_key) -{ -#ifdef WIDECHAR - static ct_buffer_t wbreak_conv, sprefix_conv; -#endif - - if (h == NULL || e == NULL) - rl_initialize(); - - if (rl_inhibit_completion) { - char arr[2]; - arr[0] = (char)invoking_key; - arr[1] = '\0'; - el_insertstr(e, arr); - return CC_REFRESH; - } - - /* Just look at how many global variables modify this operation! */ - return fn_complete(e, - (CPFunction *)rl_completion_entry_function, - rl_attempted_completion_function, - ct_decode_string(rl_basic_word_break_characters, &wbreak_conv), - ct_decode_string(rl_special_prefixes, &sprefix_conv), - _rl_completion_append_character_function, - (size_t)rl_completion_query_items, - &rl_completion_type, &rl_attempted_completion_over, - &rl_point, &rl_end); - - -} - - -/* ARGSUSED */ -static unsigned char -_el_rl_complete(EditLine *el __attribute__((__unused__)), int ch) -{ - return (unsigned char)rl_complete(0, ch); -} - -/* - * misc other functions - */ - -/* - * bind key c to readline-type function func - */ -int -rl_bind_key(int c, rl_command_func_t *func) -{ - int retval = -1; - - if (h == NULL || e == NULL) - rl_initialize(); - - if (func == rl_insert) { - /* XXX notice there is no range checking of ``c'' */ - e->el_map.key[c] = ED_INSERT; - retval = 0; - } - return retval; -} - - -/* - * read one key from input - handles chars pushed back - * to input stream also - */ -int -rl_read_key(void) -{ - char fooarr[2 * sizeof(int)]; - - if (e == NULL || h == NULL) - rl_initialize(); - - return el_getc(e, fooarr); -} - - -/* - * reset the terminal - */ -/* ARGSUSED */ -void -rl_reset_terminal(const char *p __attribute__((__unused__))) -{ - - if (h == NULL || e == NULL) - rl_initialize(); - el_reset(e); -} - - -/* - * insert character ``c'' back into input stream, ``count'' times - */ -int -rl_insert(int count, int c) -{ - char arr[2]; - - if (h == NULL || e == NULL) - rl_initialize(); - - /* XXX - int -> char conversion can lose on multichars */ - arr[0] = (char)c; - arr[1] = '\0'; - - for (; count > 0; count--) - el_push(e, arr); - - return 0; -} - -int -rl_insert_text(const char *text) -{ - if (!text || *text == 0) - return 0; - - if (h == NULL || e == NULL) - rl_initialize(); - - if (el_insertstr(e, text) < 0) - return 0; - return (int)strlen(text); -} - -/*ARGSUSED*/ -int -rl_newline(int count __attribute__((__unused__)), - int c __attribute__((__unused__))) -{ - /* - * Readline-4.0 appears to ignore the args. - */ - return rl_insert(1, '\n'); -} - -/*ARGSUSED*/ -static unsigned char -rl_bind_wrapper(EditLine *el __attribute__((__unused__)), unsigned char c) -{ - if (map[c] == NULL) - return CC_ERROR; - - _rl_update_pos(); - - (*map[c])(NULL, c); - - /* If rl_done was set by the above call, deal with it here */ - if (rl_done) - return CC_EOF; - - return CC_NORM; -} - -int -rl_add_defun(const char *name, Function *fun, int c) -{ - char dest[8]; - if ((size_t)c >= sizeof(map) / sizeof(map[0]) || c < 0) - return -1; - map[(unsigned char)c] = fun; - el_set(e, EL_ADDFN, name, name, rl_bind_wrapper); - vis(dest, c, VIS_WHITE|VIS_NOSLASH, 0); - el_set(e, EL_BIND, dest, name); - return 0; -} - -void -rl_callback_read_char() -{ - int count = 0, done = 0; - const char *buf = el_gets(e, &count); - char *wbuf; - - if (buf == NULL || count-- <= 0) - return; - if (count == 0 && buf[0] == e->el_tty.t_c[TS_IO][C_EOF]) - done = 1; - if (buf[count] == '\n' || buf[count] == '\r') - done = 2; - - if (done && rl_linefunc != NULL) { - el_set(e, EL_UNBUFFERED, 0); - if (done == 2) { - if ((wbuf = strdup(buf)) != NULL) - wbuf[count] = '\0'; - } else - wbuf = NULL; - (*(void (*)(const char *))rl_linefunc)(wbuf); - /*el_set(e, EL_UNBUFFERED, 1);*/ - } -} - -void -rl_callback_handler_install(const char *prompt, VCPFunction *linefunc) -{ - if (e == NULL) { - rl_initialize(); - } - (void)rl_set_prompt(prompt); - rl_linefunc = linefunc; - el_set(e, EL_UNBUFFERED, 1); -} - -void -rl_callback_handler_remove(void) -{ - el_set(e, EL_UNBUFFERED, 0); - rl_linefunc = NULL; -} - -void -rl_redisplay(void) -{ - char a[2]; - a[0] = (char)e->el_tty.t_c[TS_IO][C_REPRINT]; - a[1] = '\0'; - el_push(e, a); -} - -int -rl_get_previous_history(int count, int key) -{ - char a[2]; - a[0] = (char)key; - a[1] = '\0'; - while (count--) - el_push(e, a); - return 0; -} - -void -/*ARGSUSED*/ -rl_prep_terminal(int meta_flag __attribute__((__unused__))) -{ - el_set(e, EL_PREP_TERM, 1); -} - -void -rl_deprep_terminal(void) -{ - el_set(e, EL_PREP_TERM, 0); -} - -int -rl_read_init_file(const char *s) -{ - return el_source(e, s); -} - -int -rl_parse_and_bind(const char *line) -{ - const char **argv; - int argc; - Tokenizer *tok; - - tok = tok_init(NULL); - tok_str(tok, line, &argc, &argv); - argc = el_parse(e, argc, argv); - tok_end(tok); - return argc ? 1 : 0; -} - -int -rl_variable_bind(const char *var, const char *value) -{ - /* - * The proper return value is undocument, but this is what the - * readline source seems to do. - */ - return el_set(e, EL_BIND, "", var, value) == -1 ? 1 : 0; -} - -void -rl_stuff_char(int c) -{ - char buf[2]; - - buf[0] = (char)c; - buf[1] = '\0'; - el_insertstr(e, buf); -} - -static int -_rl_event_read_char(EditLine *el, char *cp) -{ - int n; - ssize_t num_read = 0; - - *cp = '\0'; - while (rl_event_hook) { - - (*rl_event_hook)(); - -#if defined(FIONREAD) - if (ioctl(el->el_infd, FIONREAD, &n) < 0) - return -1; - if (n) - num_read = read(el->el_infd, cp, (size_t)1); - else - num_read = 0; -#elif defined(F_SETFL) && defined(O_NDELAY) - if ((n = fcntl(el->el_infd, F_GETFL, 0)) < 0) - return -1; - if (fcntl(el->el_infd, F_SETFL, n|O_NDELAY) < 0) - return -1; - num_read = read(el->el_infd, cp, 1); - if (fcntl(el->el_infd, F_SETFL, n)) - return -1; -#else - /* not non-blocking, but what you gonna do? */ - num_read = read(el->el_infd, cp, 1); - return -1; -#endif - - if (num_read < 0 && errno == EAGAIN) - continue; - if (num_read == 0) - continue; - break; - } - if (!rl_event_hook) - el_set(el, EL_GETCFN, EL_BUILTIN_GETCFN); - return (int)num_read; -} - -static void -_rl_update_pos(void) -{ - const LineInfo *li = el_line(e); - - rl_point = (int)(li->cursor - li->buffer); - rl_end = (int)(li->lastchar - li->buffer); -} - -void -rl_get_screen_size(int *rows, int *cols) -{ - if (rows) - el_get(e, EL_GETTC, "li", rows); - if (cols) - el_get(e, EL_GETTC, "co", cols); -} - -void -rl_set_screen_size(int rows, int cols) -{ - char buf[64]; - (void)snprintf(buf, sizeof(buf), "%d", rows); - el_set(e, EL_SETTC, "li", buf); - (void)snprintf(buf, sizeof(buf), "%d", cols); - el_set(e, EL_SETTC, "co", buf); -} - -char ** -rl_completion_matches(const char *str, rl_compentry_func_t *fun) -{ - size_t len, max, i, j, min; - char **list, *match, *a, *b; - - len = 1; - max = 10; - if ((list = el_malloc(max * sizeof(*list))) == NULL) - return NULL; - - while ((match = (*fun)(str, (int)(len - 1))) != NULL) { - list[len++] = match; - if (len == max) { - char **nl; - max += 10; - if ((nl = el_realloc(list, max * sizeof(*nl))) == NULL) - goto out; - list = nl; - } - } - if (len == 1) - goto out; - list[len] = NULL; - if (len == 2) { - if ((list[0] = strdup(list[1])) == NULL) - goto out; - return list; - } - qsort(&list[1], len - 1, sizeof(*list), - (int (*)(const void *, const void *)) strcmp); - min = SIZE_T_MAX; - for (i = 1, a = list[i]; i < len - 1; i++, a = b) { - b = list[i + 1]; - for (j = 0; a[j] && a[j] == b[j]; j++) - continue; - if (min > j) - min = j; - } - if (min == 0 && *str) { - if ((list[0] = strdup(str)) == NULL) - goto out; - } else { - if ((list[0] = el_malloc((min + 1) * sizeof(*list[0]))) == NULL) - goto out; - (void)memcpy(list[0], list[1], min); - list[0][min] = '\0'; - } - return list; - -out: - el_free(list); - return NULL; -} - -char * -rl_filename_completion_function (const char *text, int state) -{ - return fn_filename_completion_function(text, state); -} - -void -rl_forced_update_display(void) -{ - el_set(e, EL_REFRESH); -} - -int -_rl_abort_internal(void) -{ - el_beep(e); - longjmp(topbuf, 1); - /*NOTREACHED*/ -} - -int -_rl_qsort_string_compare(char **s1, char **s2) -{ - return strcoll(*s1, *s2); -} - -HISTORY_STATE * -history_get_history_state(void) -{ - HISTORY_STATE *hs; - - if ((hs = el_malloc(sizeof(*hs))) == NULL) - return NULL; - hs->length = history_length; - return hs; -} - -int -/*ARGSUSED*/ -rl_kill_text(int from __attribute__((__unused__)), - int to __attribute__((__unused__))) -{ - return 0; -} - -Keymap -rl_make_bare_keymap(void) -{ - return NULL; -} - -Keymap -rl_get_keymap(void) -{ - return NULL; -} - -void -/*ARGSUSED*/ -rl_set_keymap(Keymap k __attribute__((__unused__))) -{ -} - -int -/*ARGSUSED*/ -rl_generic_bind(int type __attribute__((__unused__)), - const char * keyseq __attribute__((__unused__)), - const char * data __attribute__((__unused__)), - Keymap k __attribute__((__unused__))) -{ - return 0; -} - -int -/*ARGSUSED*/ -rl_bind_key_in_map(int key __attribute__((__unused__)), - rl_command_func_t *fun __attribute__((__unused__)), - Keymap k __attribute__((__unused__))) -{ - return 0; -} - -/* unsupported, but needed by python */ -void -rl_cleanup_after_signal(void) -{ -} - -int -rl_on_new_line(void) -{ - return 0; -} diff --git a/cmd-line-utils/libedit/readline/readline.h b/cmd-line-utils/libedit/readline/readline.h deleted file mode 100644 index d9efe3e01a8..00000000000 --- a/cmd-line-utils/libedit/readline/readline.h +++ /dev/null @@ -1,221 +0,0 @@ -/* $NetBSD: readline.h,v 1.32 2010/09/16 20:08:52 christos Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jaromir Dolecek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _READLINE_H_ -#define _READLINE_H_ - -#include -#include - -/* list of readline stuff supported by editline library's readline wrapper */ - -/* typedefs */ -typedef int Function(const char *, int); -typedef void VFunction(void); -typedef void VCPFunction(char *); -typedef char *CPFunction(const char *, int); -typedef char **CPPFunction(const char *, int, int); -typedef char *rl_compentry_func_t(const char *, int); -typedef int rl_command_func_t(int, int); - -/* only supports length */ -typedef struct { - int length; -} HISTORY_STATE; - -typedef void *histdata_t; - -typedef struct _hist_entry { - const char *line; - histdata_t data; -} HIST_ENTRY; - -typedef struct _keymap_entry { - char type; -#define ISFUNC 0 -#define ISKMAP 1 -#define ISMACR 2 - Function *function; -} KEYMAP_ENTRY; - -#define KEYMAP_SIZE 256 - -typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE]; -typedef KEYMAP_ENTRY *Keymap; - -#define control_character_threshold 0x20 -#define control_character_bit 0x40 - -#ifndef CTRL -#include -#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__QNXNTO__) && !defined(__USLC__) -#include -#endif -#ifndef CTRL -#define CTRL(c) ((c) & 037) -#endif -#endif -#ifndef UNCTRL -#define UNCTRL(c) (((c) - 'a' + 'A')|control_character_bit) -#endif - -#define RUBOUT 0x7f -#define ABORT_CHAR CTRL('G') -#define RL_READLINE_VERSION 0x0402 -#define RL_PROMPT_START_IGNORE '\1' -#define RL_PROMPT_END_IGNORE '\2' - -/* global variables used by readline enabled applications */ -#ifdef __cplusplus -extern "C" { -#endif -extern const char *rl_library_version; -extern int rl_readline_version; -extern char *rl_readline_name; -extern FILE *rl_instream; -extern FILE *rl_outstream; -extern char *rl_line_buffer; -extern int rl_point, rl_end; -extern int history_base, history_length; -extern int max_input_history; -extern char *rl_basic_word_break_characters; -extern char *rl_completer_word_break_characters; -extern char *rl_completer_quote_characters; -extern Function *rl_completion_entry_function; -extern CPPFunction *rl_attempted_completion_function; -extern int rl_attempted_completion_over; -extern int rl_completion_type; -extern int rl_completion_query_items; -extern char *rl_special_prefixes; -extern int rl_completion_append_character; -extern int rl_inhibit_completion; -extern Function *rl_pre_input_hook; -extern Function *rl_startup_hook; -extern char *rl_terminal_name; -extern int rl_already_prompted; -extern char *rl_prompt; -/* - * The following is not implemented - */ -extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, - emacs_meta_keymap, - emacs_ctlx_keymap; -extern int rl_filename_completion_desired; -extern int rl_ignore_completion_duplicates; -extern int (*rl_getc_function)(FILE *); -extern VFunction *rl_redisplay_function; -extern VFunction *rl_completion_display_matches_hook; -extern VFunction *rl_prep_term_function; -extern VFunction *rl_deprep_term_function; -extern int readline_echoing_p; -extern int _rl_print_completions_horizontally; - -/* supported functions */ -char *readline(const char *); -int rl_initialize(void); - -void using_history(void); -int add_history(const char *); -void clear_history(void); -void stifle_history(int); -int unstifle_history(void); -int history_is_stifled(void); -int where_history(void); -HIST_ENTRY *current_history(void); -HIST_ENTRY *history_get(int); -HIST_ENTRY *remove_history(int); -HIST_ENTRY *replace_history_entry(int, const char *, histdata_t); -int history_total_bytes(void); -int history_set_pos(int); -HIST_ENTRY *previous_history(void); -HIST_ENTRY *next_history(void); -int history_search(const char *, int); -int history_search_prefix(const char *, int); -int history_search_pos(const char *, int, int); -int read_history(const char *); -int write_history(const char *); -int history_truncate_file (const char *, int); -int history_expand(char *, char **); -char **history_tokenize(const char *); -const char *get_history_event(const char *, int *, int); -char *history_arg_extract(int, int, const char *); - -char *tilde_expand(char *); -char *filename_completion_function(const char *, int); -char *username_completion_function(const char *, int); -int rl_complete(int, int); -int rl_read_key(void); -char **completion_matches(const char *, CPFunction *); -void rl_display_match_list(char **, int, int); - -int rl_insert(int, int); -int rl_insert_text(const char *); -void rl_reset_terminal(const char *); -int rl_bind_key(int, rl_command_func_t *); -int rl_newline(int, int); -void rl_callback_read_char(void); -void rl_callback_handler_install(const char *, VCPFunction *); -void rl_callback_handler_remove(void); -void rl_redisplay(void); -int rl_get_previous_history(int, int); -void rl_prep_terminal(int); -void rl_deprep_terminal(void); -int rl_read_init_file(const char *); -int rl_parse_and_bind(const char *); -int rl_variable_bind(const char *, const char *); -void rl_stuff_char(int); -int rl_add_defun(const char *, Function *, int); -HISTORY_STATE *history_get_history_state(void); -void rl_get_screen_size(int *, int *); -void rl_set_screen_size(int, int); -char *rl_filename_completion_function (const char *, int); -int _rl_abort_internal(void); -int _rl_qsort_string_compare(char **, char **); -char **rl_completion_matches(const char *, rl_compentry_func_t *); -void rl_forced_update_display(void); -int rl_set_prompt(const char *); -int rl_on_new_line(void); - -/* - * The following are not implemented - */ -int rl_kill_text(int, int); -Keymap rl_get_keymap(void); -void rl_set_keymap(Keymap); -Keymap rl_make_bare_keymap(void); -int rl_generic_bind(int, const char *, const char *, Keymap); -int rl_bind_key_in_map(int, rl_command_func_t *, Keymap); -void rl_cleanup_after_signal(void); -void rl_free_line_state(void); -#ifdef __cplusplus -} -#endif - -#endif /* _READLINE_H_ */ diff --git a/cmd-line-utils/libedit/refresh.c b/cmd-line-utils/libedit/refresh.c deleted file mode 100644 index 64057eaabfe..00000000000 --- a/cmd-line-utils/libedit/refresh.c +++ /dev/null @@ -1,1182 +0,0 @@ -/* $NetBSD: refresh.c,v 1.37 2011/07/29 23:44:45 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * refresh.c: Lower level screen refreshing functions - */ -#include -#include -#include -#include - -#include "el.h" - -private void re_nextline(EditLine *); -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_fastputc(EditLine *, Int); -private void re_clear_eol(EditLine *, int, int, 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 *, const char *, char *, char *); -#define __F el->el_errfile -#define ELRE_ASSERT(a, b, c) do \ - if (/*CONSTCOND*/ a) { \ - (void) fprintf b; \ - c; \ - } \ - 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, const char *str, char *f, char *t) -{ - - ELRE_DEBUG(1, (__F, "%s:\"", str)); - while (f < t) - ELRE_DEBUG(1, (__F, "%c", *f++ & 0177)); - ELRE_DEBUG(1, (__F, "\"\r\n")); -} -#else -#define ELRE_ASSERT(a, b, c) -#define ELRE_DEBUG(a, b) -#endif - -/* re_nextline(): - * Move to the next line or scroll - */ -private void -re_nextline(EditLine *el) -{ - el->el_refresh.r_cursor.h = 0; /* reset it. */ - - /* - * If we would overflow (input is longer than terminal size), - * emulate scroll by dropping first line and shuffling the rest. - * We do this via pointer shuffling - it's safe in this case - * and we avoid memcpy(). - */ - if (el->el_refresh.r_cursor.v + 1 >= el->el_terminal.t_size.v) { - int i, lins = el->el_terminal.t_size.v; - Char *firstline = el->el_vdisplay[0]; - - for(i = 1; i < lins; i++) - el->el_vdisplay[i - 1] = el->el_vdisplay[i]; - - firstline[0] = '\0'; /* empty the string */ - el->el_vdisplay[i - 1] = firstline; - } else - el->el_refresh.r_cursor.v++; - - ELRE_ASSERT(el->el_refresh.r_cursor.v >= el->el_terminal.t_size.v, - (__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n", - el->el_refresh.r_cursor.v, el->el_terminal.t_size.v), - abort()); -} - -/* re_addc(): - * Draw c, expanding tabs, control chars etc. - */ -private void -re_addc(EditLine *el, Int c) -{ - switch (ct_chr_class((Char)c)) { - case CHTYPE_TAB: /* expand the tab */ - for (;;) { - re_putc(el, ' ', 1); - if ((el->el_refresh.r_cursor.h & 07) == 0) - break; /* go until tab stop */ - } - break; - case CHTYPE_NL: { - int oldv = el->el_refresh.r_cursor.v; - re_putc(el, '\0', 0); /* assure end of line */ - if (oldv == el->el_refresh.r_cursor.v) /* XXX */ - re_nextline(el); - break; - } - case CHTYPE_PRINT: - re_putc(el, c, 1); - break; - default: { - Char visbuf[VISUAL_WIDTH_MAX]; - ssize_t i, n = - ct_visual_char(visbuf, VISUAL_WIDTH_MAX, (Char)c); - for (i = 0; n-- > 0; ++i) - re_putc(el, visbuf[i], 1); - break; - } - } -} - - -/* re_putc(): - * Draw the character given - */ -protected void -re_putc(EditLine *el, Int c, int shift) -{ - int i, w = Width(c); - ELRE_DEBUG(1, (__F, "printing %5x '%c'\r\n", c, c)); - - while (shift && (el->el_refresh.r_cursor.h + w > el->el_terminal.t_size.h)) - re_putc(el, ' ', 1); - - el->el_vdisplay[el->el_refresh.r_cursor.v] - [el->el_refresh.r_cursor.h] = c; - /* assumes !shift is only used for single-column chars */ - i = w; - while (--i > 0) - el->el_vdisplay[el->el_refresh.r_cursor.v] - [el->el_refresh.r_cursor.h + i] = MB_FILL_CHAR; - - if (!shift) - return; - - el->el_refresh.r_cursor.h += w; /* advance to next place */ - if (el->el_refresh.r_cursor.h >= el->el_terminal.t_size.h) { - /* assure end of line */ - el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_terminal.t_size.h] - = '\0'; - re_nextline(el); - } -} - - -/* re_refresh(): - * draws the new virtual screen image from the current input - * line, then goes line-by-line changing the real image to the new - * virtual image. The routine to re-draw a line can be replaced - * easily in hopes of a smarter one being placed there. - */ -protected void -re_refresh(EditLine *el) -{ - int i, rhdiff; - Char *cp, *st; - coord_t cur; -#ifdef notyet - size_t termsz; -#endif - - ELRE_DEBUG(1, (__F, "el->el_line.buffer = :%s:\r\n", - el->el_line.buffer)); - - /* reset the Drawing cursor */ - el->el_refresh.r_cursor.h = 0; - el->el_refresh.r_cursor.v = 0; - - /* temporarily draw rprompt to calculate its size */ - prompt_print(el, EL_RPROMPT); - - /* reset the Drawing cursor */ - 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; - - prompt_print(el, EL_PROMPT); - - /* draw the current input buffer */ -#if notyet - termsz = el->el_terminal.t_size.h * el->el_terminal.t_size.v; - if (el->el_line.lastchar - el->el_line.buffer > termsz) { - /* - * If line is longer than terminal, process only part - * of line which would influence display. - */ - size_t rem = (el->el_line.lastchar-el->el_line.buffer)%termsz; - - st = el->el_line.lastchar - rem - - (termsz - (((rem / el->el_terminal.t_size.v) - 1) - * el->el_terminal.t_size.v)); - } else -#endif - st = el->el_line.buffer; - - for (cp = st; cp < el->el_line.lastchar; cp++) { - if (cp == el->el_line.cursor) { - int w = Width(*cp); - /* save for later */ - cur.h = el->el_refresh.r_cursor.h; - cur.v = el->el_refresh.r_cursor.v; - /* handle being at a linebroken doublewidth char */ - if (w > 1 && el->el_refresh.r_cursor.h + w > - el->el_terminal.t_size.h) { - cur.h = 0; - cur.v++; - } - } - re_addc(el, *cp); - } - - if (cur.h == -1) { /* if I haven't been set yet, I'm at the end */ - cur.h = el->el_refresh.r_cursor.h; - cur.v = el->el_refresh.r_cursor.v; - } - rhdiff = el->el_terminal.t_size.h - el->el_refresh.r_cursor.h - - el->el_rprompt.p_pos.h; - if (el->el_rprompt.p_pos.h && !el->el_rprompt.p_pos.v && - !el->el_refresh.r_cursor.v && rhdiff > 1) { - /* - * have a right-hand side prompt that will fit - * on the end of the first line with at least - * one character gap to the input buffer. - */ - while (--rhdiff > 0) /* pad out with spaces */ - re_putc(el, ' ', 1); - prompt_print(el, EL_RPROMPT); - } else { - el->el_rprompt.p_pos.h = 0; /* flag "not using rprompt" */ - el->el_rprompt.p_pos.v = 0; - } - - re_putc(el, '\0', 0); /* make line ended with NUL, no cursor shift */ - - el->el_refresh.r_newcv = el->el_refresh.r_cursor.v; - - ELRE_DEBUG(1, (__F, - "term.h=%d vcur.h=%d vcur.v=%d vdisplay[0]=\r\n:%80.80s:\r\n", - el->el_terminal.t_size.h, el->el_refresh.r_cursor.h, - el->el_refresh.r_cursor.v, ct_encode_string(el->el_vdisplay[0]))); - - ELRE_DEBUG(1, (__F, "updating %d lines.\r\n", el->el_refresh.r_newcv)); - for (i = 0; i <= el->el_refresh.r_newcv; i++) { - /* NOTE THAT re_update_line MAY CHANGE el_display[i] */ - re_update_line(el, el->el_display[i], el->el_vdisplay[i], i); - - /* - * Copy the new line to be the current one, and pad out with - * spaces to the full width of the terminal so that if we try - * moving the cursor by writing the character that is at the - * end of the screen line, it won't be a NUL or some old - * leftover stuff. - */ - re__copy_and_pad(el->el_display[i], el->el_vdisplay[i], - (size_t) el->el_terminal.t_size.h); - } - ELRE_DEBUG(1, (__F, - "\r\nel->el_refresh.r_cursor.v=%d,el->el_refresh.r_oldcv=%d i=%d\r\n", - el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i)); - - if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv) - for (; i <= el->el_refresh.r_oldcv; i++) { - terminal_move_to_line(el, i); - terminal_move_to_char(el, 0); - /* This Strlen should be safe even with MB_FILL_CHARs */ - terminal_clear_EOL(el, (int) Strlen(el->el_display[i])); -#ifdef DEBUG_REFRESH - terminal_overwrite(el, "C\b", (size_t)2); -#endif /* DEBUG_REFRESH */ - el->el_display[i][0] = '\0'; - } - - el->el_refresh.r_oldcv = el->el_refresh.r_newcv; /* set for next time */ - ELRE_DEBUG(1, (__F, - "\r\ncursor.h = %d, cursor.v = %d, cur.h = %d, cur.v = %d\r\n", - el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, - cur.h, cur.v)); - terminal_move_to_line(el, cur.v); /* go to where the cursor is */ - terminal_move_to_char(el, cur.h); -} - - -/* re_goto_bottom(): - * used to go to last used screen line - */ -protected void -re_goto_bottom(EditLine *el) -{ - - terminal_move_to_line(el, el->el_refresh.r_oldcv); - terminal__putc(el, '\n'); - re_clear_display(el); - terminal__flush(el); -} - - -/* re_insert(): - * insert num characters of s into d (in front of the character) - * at dat, maximum length of d is dlen - */ -private void -/*ARGSUSED*/ -re_insert(EditLine *el __attribute__((__unused__)), - Char *d, int dat, int dlen, Char *s, int num) -{ - Char *a, *b; - - if (num <= 0) - return; - if (num > dlen - dat) - num = dlen - dat; - - ELRE_DEBUG(1, - (__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n", - num, dat, dlen, ct_encode_string(d))); - ELRE_DEBUG(1, (__F, "s == \"%s\"\n", ct_encode_string(s))); - - /* open up the space for num chars */ - if (num > 0) { - b = d + dlen - 1; - a = b - num; - while (a >= &d[dat]) - *b-- = *a--; - d[dlen] = '\0'; /* just in case */ - } - - ELRE_DEBUG(1, (__F, - "re_insert() after insert: %d at %d max %d, d == \"%s\"\n", - num, dat, dlen, ct_encode_string(d))); - ELRE_DEBUG(1, (__F, "s == \"%s\"\n", ct_encode_string(s))); - - /* copy the characters */ - for (a = d + dat; (a < d + dlen) && (num > 0); num--) - *a++ = *s++; - -#ifdef notyet - /* ct_encode_string() uses a static buffer, so we can't conveniently - * encode both d & s here */ - ELRE_DEBUG(1, - (__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n", - num, dat, dlen, d, s)); - ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s)); -#endif -} - - -/* re_delete(): - * delete num characters d at dat, maximum length of d is dlen - */ -private void -/*ARGSUSED*/ -re_delete(EditLine *el __attribute__((__unused__)), - Char *d, int dat, int dlen, int num) -{ - Char *a, *b; - - if (num <= 0) - return; - if (dat + num >= dlen) { - d[dat] = '\0'; - return; - } - ELRE_DEBUG(1, - (__F, "re_delete() starting: %d at %d max %d, d == \"%s\"\n", - num, dat, dlen, ct_encode_string(d))); - - /* open up the space for num chars */ - if (num > 0) { - b = d + dat; - a = b + num; - while (a < &d[dlen]) - *b++ = *a++; - d[dlen] = '\0'; /* just in case */ - } - ELRE_DEBUG(1, - (__F, "re_delete() after delete: %d at %d max %d, d == \"%s\"\n", - num, dat, dlen, ct_encode_string(d))); -} - - -/* re__strncopy(): - * Like strncpy without padding. - */ -private void -re__strncopy(Char *a, Char *b, size_t n) -{ - - while (n-- && *b) - *a++ = *b++; -} - -/* re_clear_eol(): - * Find the number of characters we need to clear till the end of line - * in order to make sure that we have cleared the previous contents of - * the line. fx and sx is the number of characters inserted or deleted - * in the first or second diff, diff is the difference between the - * number of characters between the new and old line. - */ -private void -re_clear_eol(EditLine *el, int fx, int sx, int diff) -{ - - ELRE_DEBUG(1, (__F, "re_clear_eol sx %d, fx %d, diff %d\n", - sx, fx, diff)); - - if (fx < 0) - fx = -fx; - if (sx < 0) - sx = -sx; - if (fx > diff) - diff = fx; - if (sx > diff) - diff = sx; - - ELRE_DEBUG(1, (__F, "re_clear_eol %d\n", diff)); - terminal_clear_EOL(el, diff); -} - -/***************************************************************** - re_update_line() is based on finding the middle difference of each line - on the screen; vis: - - /old first difference - /beginning of line | /old last same /old EOL - v v v v -old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as -new: eddie> Oh, my little buggy says to me, as lurgid as - ^ ^ ^ ^ - \beginning of line | \new last same \new end of line - \new first difference - - all are character pointers for the sake of speed. Special cases for - no differences, as well as for end of line additions must be handled. -**************************************************************** */ - -/* Minimum at which doing an insert it "worth it". This should be about - * half the "cost" of going into insert mode, inserting a character, and - * going back out. This should really be calculated from the termcap - * data... For the moment, a good number for ANSI terminals. - */ -#define MIN_END_KEEP 4 - -private void -re_update_line(EditLine *el, Char *old, Char *new, int i) -{ - Char *o, *n, *p, c; - Char *ofd, *ols, *oe, *nfd, *nls, *ne; - Char *osb, *ose, *nsb, *nse; - int fx, sx; - size_t len; - - /* - * find first diff - */ - for (o = old, n = new; *o && (*o == *n); o++, n++) - continue; - ofd = o; - nfd = n; - - /* - * Find the end of both old and new - */ - while (*o) - o++; - /* - * Remove any trailing blanks off of the end, being careful not to - * back up past the beginning. - */ - while (ofd < o) { - if (o[-1] != ' ') - break; - o--; - } - oe = o; - *oe = '\0'; - - while (*n) - n++; - - /* remove blanks from end of new */ - while (nfd < n) { - if (n[-1] != ' ') - break; - n--; - } - ne = n; - *ne = '\0'; - - /* - * if no diff, continue to next line of redraw - */ - if (*ofd == '\0' && *nfd == '\0') { - ELRE_DEBUG(1, (__F, "no difference.\r\n")); - return; - } - /* - * find last same pointer - */ - while ((o > ofd) && (n > nfd) && (*--o == *--n)) - continue; - ols = ++o; - nls = ++n; - - /* - * find same begining and same end - */ - osb = ols; - nsb = nls; - ose = ols; - nse = nls; - - /* - * case 1: insert: scan from nfd to nls looking for *ofd - */ - if (*ofd) { - for (c = *ofd, n = nfd; n < nls; n++) { - if (c == *n) { - for (o = ofd, p = n; - p < nls && o < ols && *o == *p; - o++, p++) - continue; - /* - * if the new match is longer and it's worth - * keeping, then we take it - */ - if (((nse - nsb) < (p - n)) && - (2 * (p - n) > n - nfd)) { - nsb = n; - nse = p; - osb = ofd; - ose = o; - } - } - } - } - /* - * case 2: delete: scan from ofd to ols looking for *nfd - */ - if (*nfd) { - for (c = *nfd, o = ofd; o < ols; o++) { - if (c == *o) { - for (n = nfd, p = o; - p < ols && n < nls && *p == *n; - p++, n++) - continue; - /* - * if the new match is longer and it's worth - * keeping, then we take it - */ - if (((ose - osb) < (p - o)) && - (2 * (p - o) > o - ofd)) { - nsb = nfd; - nse = n; - osb = o; - ose = p; - } - } - } - } - /* - * Pragmatics I: If old trailing whitespace or not enough characters to - * save to be worth it, then don't save the last same info. - */ - if ((oe - ols) < MIN_END_KEEP) { - ols = oe; - nls = ne; - } - /* - * Pragmatics II: if the terminal isn't smart enough, make the data - * dumber so the smart update doesn't try anything fancy - */ - - /* - * fx is the number of characters we need to insert/delete: in the - * beginning to bring the two same begins together - */ - fx = (int)((nsb - nfd) - (osb - ofd)); - /* - * sx is the number of characters we need to insert/delete: in the - * end to bring the two same last parts together - */ - sx = (int)((nls - nse) - (ols - ose)); - - if (!EL_CAN_INSERT) { - if (fx > 0) { - osb = ols; - ose = ols; - nsb = nls; - nse = nls; - } - if (sx > 0) { - ols = oe; - nls = ne; - } - if ((ols - ofd) < (nls - nfd)) { - ols = oe; - nls = ne; - } - } - if (!EL_CAN_DELETE) { - if (fx < 0) { - osb = ols; - ose = ols; - nsb = nls; - nse = nls; - } - if (sx < 0) { - ols = oe; - nls = ne; - } - if ((ols - ofd) > (nls - nfd)) { - ols = oe; - nls = ne; - } - } - /* - * Pragmatics III: make sure the middle shifted pointers are correct if - * they don't point to anything (we may have moved ols or nls). - */ - /* if the change isn't worth it, don't bother */ - /* was: if (osb == ose) */ - if ((ose - osb) < MIN_END_KEEP) { - osb = ols; - ose = ols; - nsb = nls; - nse = nls; - } - /* - * Now that we are done with pragmatics we recompute fx, sx - */ - fx = (int)((nsb - nfd) - (osb - ofd)); - sx = (int)((nls - nse) - (ols - ose)); - - ELRE_DEBUG(1, (__F, "fx %d, sx %d\n", fx, sx)); - ELRE_DEBUG(1, (__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n", - ofd - old, osb - old, ose - old, ols - old, oe - old)); - ELRE_DEBUG(1, (__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n", - nfd - new, nsb - new, nse - new, nls - new, ne - new)); - ELRE_DEBUG(1, (__F, - "xxx-xxx:\"00000000001111111111222222222233333333334\"\r\n")); - ELRE_DEBUG(1, (__F, - "xxx-xxx:\"01234567890123456789012345678901234567890\"\r\n")); -#ifdef DEBUG_REFRESH - re_printstr(el, "old- oe", old, oe); - re_printstr(el, "new- ne", new, ne); - re_printstr(el, "old-ofd", old, ofd); - re_printstr(el, "new-nfd", new, nfd); - re_printstr(el, "ofd-osb", ofd, osb); - re_printstr(el, "nfd-nsb", nfd, nsb); - re_printstr(el, "osb-ose", osb, ose); - re_printstr(el, "nsb-nse", nsb, nse); - re_printstr(el, "ose-ols", ose, ols); - re_printstr(el, "nse-nls", nse, nls); - re_printstr(el, "ols- oe", ols, oe); - re_printstr(el, "nls- ne", nls, ne); -#endif /* DEBUG_REFRESH */ - - /* - * el_cursor.v to this line i MUST be in this routine so that if we - * don't have to change the line, we don't move to it. el_cursor.h to - * first diff char - */ - terminal_move_to_line(el, i); - - /* - * at this point we have something like this: - * - * /old /ofd /osb /ose /ols /oe - * v.....................v v..................v v........v - * eddie> Oh, my fredded gruntle-buggy is to me, as foo var lurgid as - * eddie> Oh, my fredded quiux buggy is to me, as gruntle-lurgid as - * ^.....................^ ^..................^ ^........^ - * \new \nfd \nsb \nse \nls \ne - * - * fx is the difference in length between the chars between nfd and - * nsb, and the chars between ofd and osb, and is thus the number of - * characters to delete if < 0 (new is shorter than old, as above), - * or insert (new is longer than short). - * - * sx is the same for the second differences. - */ - - /* - * if we have a net insert on the first difference, AND inserting the - * net amount ((nsb-nfd) - (osb-ofd)) won't push the last useful - * character (which is ne if nls != ne, otherwise is nse) off the edge - * of the screen (el->el_terminal.t_size.h) else we do the deletes first - * so that we keep everything we need to. - */ - - /* - * if the last same is the same like the end, there is no last same - * part, otherwise we want to keep the last same part set p to the - * last useful old character - */ - p = (ols != oe) ? oe : ose; - - /* - * if (There is a diffence in the beginning) && (we need to insert - * characters) && (the number of characters to insert is less than - * the term width) - * We need to do an insert! - * else if (we need to delete characters) - * We need to delete characters! - * else - * No insert or delete - */ - if ((nsb != nfd) && fx > 0 && - ((p - old) + fx <= el->el_terminal.t_size.h)) { - ELRE_DEBUG(1, - (__F, "first diff insert at %d...\r\n", nfd - new)); - /* - * Move to the first char to insert, where the first diff is. - */ - terminal_move_to_char(el, (int)(nfd - new)); - /* - * Check if we have stuff to keep at end - */ - if (nsb != ne) { - ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n")); - /* - * insert fx chars of new starting at nfd - */ - if (fx > 0) { - ELRE_DEBUG(!EL_CAN_INSERT, (__F, - "ERROR: cannot insert in early first diff\n")); - terminal_insertwrite(el, nfd, fx); - re_insert(el, old, (int)(ofd - old), - el->el_terminal.t_size.h, nfd, fx); - } - /* - * write (nsb-nfd) - fx chars of new starting at - * (nfd + fx) - */ - len = (size_t) ((nsb - nfd) - fx); - terminal_overwrite(el, (nfd + fx), len); - re__strncopy(ofd + fx, nfd + fx, len); - } else { - ELRE_DEBUG(1, (__F, "without anything to save\r\n")); - len = (size_t)(nsb - nfd); - terminal_overwrite(el, nfd, len); - re__strncopy(ofd, nfd, len); - /* - * Done - */ - return; - } - } else if (fx < 0) { - ELRE_DEBUG(1, - (__F, "first diff delete at %d...\r\n", ofd - old)); - /* - * move to the first char to delete where the first diff is - */ - terminal_move_to_char(el, (int)(ofd - old)); - /* - * Check if we have stuff to save - */ - if (osb != oe) { - ELRE_DEBUG(1, (__F, "with stuff to save at end\r\n")); - /* - * fx is less than zero *always* here but we check - * for code symmetry - */ - if (fx < 0) { - ELRE_DEBUG(!EL_CAN_DELETE, (__F, - "ERROR: cannot delete in first diff\n")); - terminal_deletechars(el, -fx); - re_delete(el, old, (int)(ofd - old), - el->el_terminal.t_size.h, -fx); - } - /* - * write (nsb-nfd) chars of new starting at nfd - */ - len = (size_t) (nsb - nfd); - terminal_overwrite(el, nfd, len); - re__strncopy(ofd, nfd, len); - - } else { - ELRE_DEBUG(1, (__F, - "but with nothing left to save\r\n")); - /* - * write (nsb-nfd) chars of new starting at nfd - */ - terminal_overwrite(el, nfd, (size_t)(nsb - nfd)); - re_clear_eol(el, fx, sx, - (int)((oe - old) - (ne - new))); - /* - * Done - */ - return; - } - } else - fx = 0; - - if (sx < 0 && (ose - old) + fx < el->el_terminal.t_size.h) { - ELRE_DEBUG(1, (__F, - "second diff delete at %d...\r\n", (ose - old) + fx)); - /* - * Check if we have stuff to delete - */ - /* - * fx is the number of characters inserted (+) or deleted (-) - */ - - terminal_move_to_char(el, (int)((ose - old) + fx)); - /* - * Check if we have stuff to save - */ - if (ols != oe) { - ELRE_DEBUG(1, (__F, "with stuff to save at end\r\n")); - /* - * Again a duplicate test. - */ - if (sx < 0) { - ELRE_DEBUG(!EL_CAN_DELETE, (__F, - "ERROR: cannot delete in second diff\n")); - terminal_deletechars(el, -sx); - } - /* - * write (nls-nse) chars of new starting at nse - */ - terminal_overwrite(el, nse, (size_t)(nls - nse)); - } else { - ELRE_DEBUG(1, (__F, - "but with nothing left to save\r\n")); - terminal_overwrite(el, nse, (size_t)(nls - nse)); - re_clear_eol(el, fx, sx, - (int)((oe - old) - (ne - new))); - } - } - /* - * if we have a first insert AND WE HAVEN'T ALREADY DONE IT... - */ - if ((nsb != nfd) && (osb - ofd) <= (nsb - nfd) && (fx == 0)) { - ELRE_DEBUG(1, (__F, "late first diff insert at %d...\r\n", - nfd - new)); - - terminal_move_to_char(el, (int)(nfd - new)); - /* - * Check if we have stuff to keep at the end - */ - if (nsb != ne) { - ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n")); - /* - * We have to recalculate fx here because we set it - * to zero above as a flag saying that we hadn't done - * an early first insert. - */ - fx = (int)((nsb - nfd) - (osb - ofd)); - if (fx > 0) { - /* - * insert fx chars of new starting at nfd - */ - ELRE_DEBUG(!EL_CAN_INSERT, (__F, - "ERROR: cannot insert in late first diff\n")); - terminal_insertwrite(el, nfd, fx); - re_insert(el, old, (int)(ofd - old), - el->el_terminal.t_size.h, nfd, fx); - } - /* - * write (nsb-nfd) - fx chars of new starting at - * (nfd + fx) - */ - len = (size_t) ((nsb - nfd) - fx); - terminal_overwrite(el, (nfd + fx), len); - re__strncopy(ofd + fx, nfd + fx, len); - } else { - ELRE_DEBUG(1, (__F, "without anything to save\r\n")); - len = (size_t) (nsb - nfd); - terminal_overwrite(el, nfd, len); - re__strncopy(ofd, nfd, len); - } - } - /* - * line is now NEW up to nse - */ - if (sx >= 0) { - ELRE_DEBUG(1, (__F, - "second diff insert at %d...\r\n", (int)(nse - new))); - terminal_move_to_char(el, (int)(nse - new)); - if (ols != oe) { - ELRE_DEBUG(1, (__F, "with stuff to keep at end\r\n")); - if (sx > 0) { - /* insert sx chars of new starting at nse */ - ELRE_DEBUG(!EL_CAN_INSERT, (__F, - "ERROR: cannot insert in second diff\n")); - terminal_insertwrite(el, nse, sx); - } - /* - * write (nls-nse) - sx chars of new starting at - * (nse + sx) - */ - terminal_overwrite(el, (nse + sx), - (size_t)((nls - nse) - sx)); - } else { - ELRE_DEBUG(1, (__F, "without anything to save\r\n")); - terminal_overwrite(el, nse, (size_t)(nls - nse)); - - /* - * No need to do a clear-to-end here because we were - * doing a second insert, so we will have over - * written all of the old string. - */ - } - } - ELRE_DEBUG(1, (__F, "done.\r\n")); -} - - -/* re__copy_and_pad(): - * Copy string and pad with spaces - */ -private void -re__copy_and_pad(Char *dst, const Char *src, size_t width) -{ - size_t i; - - for (i = 0; i < width; i++) { - if (*src == '\0') - break; - *dst++ = *src++; - } - - for (; i < width; i++) - *dst++ = ' '; - - *dst = '\0'; -} - - -/* re_refresh_cursor(): - * Move to the new cursor position - */ -protected void -re_refresh_cursor(EditLine *el) -{ - Char *cp; - int h, v, th, w; - - 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; - th = el->el_terminal.t_size.h; /* optimize for speed */ - - /* do input buffer to el->el_line.cursor */ - for (cp = el->el_line.buffer; cp < el->el_line.cursor; cp++) { - switch (ct_chr_class(*cp)) { - case CHTYPE_NL: /* handle newline in data part too */ - h = 0; - v++; - break; - case CHTYPE_TAB: /* if a tab, to next tab stop */ - while (++h & 07) - continue; - break; - default: - w = Width(*cp); - if (w > 1 && h + w > th) { /* won't fit on line */ - h = 0; - v++; - } - h += ct_visual_width(*cp); - break; - } - - if (h >= th) { /* check, extra long tabs picked up here also */ - h -= th; - v++; - } - } - /* if we have a next character, and it's a doublewidth one, we need to - * check whether we need to linebreak for it to fit */ - if (cp < el->el_line.lastchar && (w = Width(*cp)) > 1) - if (h + w > th) { - h = 0; - v++; - } - - /* now go there */ - terminal_move_to_line(el, v); - terminal_move_to_char(el, h); - terminal__flush(el); -} - - -/* re_fastputc(): - * Add a character fast. - */ -private void -re_fastputc(EditLine *el, Int c) -{ - int w = Width((Char)c); - while (w > 1 && el->el_cursor.h + w > el->el_terminal.t_size.h) - re_fastputc(el, ' '); - - terminal__putc(el, c); - el->el_display[el->el_cursor.v][el->el_cursor.h++] = c; - while (--w > 0) - el->el_display[el->el_cursor.v][el->el_cursor.h++] - = MB_FILL_CHAR; - - if (el->el_cursor.h >= el->el_terminal.t_size.h) { - /* if we must overflow */ - el->el_cursor.h = 0; - - /* - * If we would overflow (input is longer than terminal size), - * emulate scroll by dropping first line and shuffling the rest. - * We do this via pointer shuffling - it's safe in this case - * and we avoid memcpy(). - */ - if (el->el_cursor.v + 1 >= el->el_terminal.t_size.v) { - int i, lins = el->el_terminal.t_size.v; - Char *firstline = el->el_display[0]; - - for(i = 1; i < lins; i++) - el->el_display[i - 1] = el->el_display[i]; - - re__copy_and_pad(firstline, STR(""), (size_t)0); - el->el_display[i - 1] = firstline; - } else { - el->el_cursor.v++; - el->el_refresh.r_oldcv++; - } - if (EL_HAS_AUTO_MARGINS) { - if (EL_HAS_MAGIC_MARGINS) { - terminal__putc(el, ' '); - terminal__putc(el, '\b'); - } - } else { - terminal__putc(el, '\r'); - terminal__putc(el, '\n'); - } - } -} - - -/* re_fastaddc(): - * we added just one char, handle it fast. - * Assumes that screen cursor == real cursor - */ -protected void -re_fastaddc(EditLine *el) -{ - Char c; - int rhdiff; - - c = el->el_line.cursor[-1]; - - if (c == '\t' || el->el_line.cursor != el->el_line.lastchar) { - re_refresh(el); /* too hard to handle */ - return; - } - rhdiff = el->el_terminal.t_size.h - el->el_cursor.h - - el->el_rprompt.p_pos.h; - if (el->el_rprompt.p_pos.h && rhdiff < 3) { - re_refresh(el); /* clear out rprompt if less than 1 char gap */ - return; - } /* else (only do at end of line, no TAB) */ - switch (ct_chr_class(c)) { - case CHTYPE_TAB: /* already handled, should never happen here */ - break; - case CHTYPE_NL: - case CHTYPE_PRINT: - re_fastputc(el, c); - break; - case CHTYPE_ASCIICTL: - case CHTYPE_NONPRINT: { - Char visbuf[VISUAL_WIDTH_MAX]; - ssize_t i, n = - ct_visual_char(visbuf, VISUAL_WIDTH_MAX, (Char)c); - for (i = 0; n-- > 0; ++i) - re_fastputc(el, visbuf[i]); - break; - } - } - terminal__flush(el); -} - - -/* re_clear_display(): - * clear the screen buffers so that new new prompt starts fresh. - */ -protected void -re_clear_display(EditLine *el) -{ - int i; - - el->el_cursor.v = 0; - el->el_cursor.h = 0; - for (i = 0; i < el->el_terminal.t_size.v; i++) - el->el_display[i][0] = '\0'; - el->el_refresh.r_oldcv = 0; -} - - -/* re_clear_lines(): - * Make sure all lines are *really* blank - */ -protected void -re_clear_lines(EditLine *el) -{ - - if (EL_CAN_CEOL) { - int i; - for (i = el->el_refresh.r_oldcv; i >= 0; i--) { - /* for each line on the screen */ - terminal_move_to_line(el, i); - terminal_move_to_char(el, 0); - terminal_clear_EOL(el, el->el_terminal.t_size.h); - } - } else { - terminal_move_to_line(el, el->el_refresh.r_oldcv); - /* go to last line */ - terminal__putc(el, '\r'); /* go to BOL */ - terminal__putc(el, '\n'); /* go to new line */ - } -} diff --git a/cmd-line-utils/libedit/refresh.h b/cmd-line-utils/libedit/refresh.h deleted file mode 100644 index f80be463545..00000000000 --- a/cmd-line-utils/libedit/refresh.h +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: refresh.h,v 1.6 2009/12/30 22:37:40 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)refresh.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.refresh.h: Screen refresh functions - */ -#ifndef _h_el_refresh -#define _h_el_refresh - -#include "histedit.h" - -typedef struct { - coord_t r_cursor; /* Refresh cursor position */ - int r_oldcv; /* Vertical locations */ - int r_newcv; -} el_refresh_t; - -protected void re_putc(EditLine *, Int, int); -protected void re_clear_lines(EditLine *); -protected void re_clear_display(EditLine *); -protected void re_refresh(EditLine *); -protected void re_refresh_cursor(EditLine *); -protected void re_fastaddc(EditLine *); -protected void re_goto_bottom(EditLine *); - -#endif /* _h_el_refresh */ diff --git a/cmd-line-utils/libedit/search.c b/cmd-line-utils/libedit/search.c deleted file mode 100644 index 2324cc94d76..00000000000 --- a/cmd-line-utils/libedit/search.c +++ /dev/null @@ -1,640 +0,0 @@ -/* $NetBSD: search.c,v 1.30 2011/10/04 15:27:04 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * search.c: History and character search functions - */ -#include -#if defined(REGEX) -#include -#elif defined(REGEXP) -#include -#endif -#include "el.h" - -/* - * Adjust cursor in vi mode to include the character under it - */ -#define EL_CURSOR(el) \ - ((el)->el_line.cursor + (((el)->el_map.type == MAP_VI) && \ - ((el)->el_map.current == (el)->el_map.alt))) - -/* search_init(): - * Initialize the search stuff - */ -protected int -search_init(EditLine *el) -{ - - el->el_search.patbuf = el_malloc(EL_BUFSIZ * - sizeof(*el->el_search.patbuf)); - if (el->el_search.patbuf == NULL) - return -1; - el->el_search.patlen = 0; - el->el_search.patdir = -1; - el->el_search.chacha = '\0'; - el->el_search.chadir = CHAR_FWD; - el->el_search.chatflg = 0; - return 0; -} - - -/* search_end(): - * Initialize the search stuff - */ -protected void -search_end(EditLine *el) -{ - - el_free(el->el_search.patbuf); - el->el_search.patbuf = NULL; -} - - -#ifdef REGEXP -/* regerror(): - * Handle regular expression errors - */ -public void -/*ARGSUSED*/ -regerror(const char *msg) -{ -} -#endif - - -/* el_match(): - * Return if string matches pattern - */ -protected int -el_match(const Char *str, const Char *pat) -{ -#ifdef WIDECHAR - static ct_buffer_t conv; -#endif -#if defined (REGEX) - regex_t re; - int rv; -#elif defined (REGEXP) - regexp *rp; - int rv; -#else - extern char *re_comp(const char *); - extern int re_exec(const char *); -#endif - - if (Strstr(str, pat) != 0) - return 1; - -#if defined(REGEX) - if (regcomp(&re, ct_encode_string(pat, &conv), 0) == 0) { - rv = regexec(&re, ct_encode_string(str, &conv), (size_t)0, NULL, - 0) == 0; - regfree(&re); - } else { - rv = 0; - } - return rv; -#elif defined(REGEXP) - if ((re = regcomp(ct_encode_string(pat, &conv))) != NULL) { - rv = regexec(re, ct_encode_string(str, &conv)); - el_free(re); - } else { - rv = 0; - } - return rv; -#else - if (re_comp(ct_encode_string(pat, &conv)) != NULL) - return 0; - else - return re_exec(ct_encode_string(str, &conv) == 1); -#endif -} - - -/* c_hmatch(): - * return True if the pattern matches the prefix - */ -protected int -c_hmatch(EditLine *el, const Char *str) -{ -#ifdef SDEBUG - (void) fprintf(el->el_errfile, "match `%s' with `%s'\n", - el->el_search.patbuf, str); -#endif /* SDEBUG */ - - return el_match(str, el->el_search.patbuf); -} - - -/* c_setpat(): - * Set the history seatch pattern - */ -protected void -c_setpat(EditLine *el) -{ - if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && - el->el_state.lastcmd != ED_SEARCH_NEXT_HISTORY) { - el->el_search.patlen = - (size_t)(EL_CURSOR(el) - el->el_line.buffer); - if (el->el_search.patlen >= EL_BUFSIZ) - el->el_search.patlen = EL_BUFSIZ - 1; - if (el->el_search.patlen != 0) { - (void) Strncpy(el->el_search.patbuf, el->el_line.buffer, - el->el_search.patlen); - el->el_search.patbuf[el->el_search.patlen] = '\0'; - } else - el->el_search.patlen = Strlen(el->el_search.patbuf); - } -#ifdef SDEBUG - (void) fprintf(el->el_errfile, "\neventno = %d\n", - el->el_history.eventno); - (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen); - (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", - el->el_search.patbuf); - (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", - EL_CURSOR(el) - el->el_line.buffer, - el->el_line.lastchar - el->el_line.buffer); -#endif -} - - -/* ce_inc_search(): - * Emacs incremental search - */ -protected el_action_t -ce_inc_search(EditLine *el, int dir) -{ - static const Char STRfwd[] = {'f', 'w', 'd', '\0'}, - STRbck[] = {'b', 'c', 'k', '\0'}; - static Char pchar = ':';/* ':' = normal, '?' = failed */ - static Char endcmd[2] = {'\0', '\0'}; - Char ch, *ocursor = el->el_line.cursor, oldpchar = pchar; - const Char *cp; - - el_action_t ret = CC_NORM; - - int ohisteventno = el->el_history.eventno; - size_t oldpatlen = el->el_search.patlen; - int newdir = dir; - int done, redo; - - if (el->el_line.lastchar + sizeof(STRfwd) / - sizeof(*el->el_line.lastchar) + 2 + - el->el_search.patlen >= el->el_line.limit) - return CC_ERROR; - - for (;;) { - - if (el->el_search.patlen == 0) { /* first round */ - pchar = ':'; -#ifdef ANCHOR -#define LEN 2 - el->el_search.patbuf[el->el_search.patlen++] = '.'; - el->el_search.patbuf[el->el_search.patlen++] = '*'; -#else -#define LEN 0 -#endif - } - done = redo = 0; - *el->el_line.lastchar++ = '\n'; - for (cp = (newdir == ED_SEARCH_PREV_HISTORY) ? STRbck : STRfwd; - *cp; *el->el_line.lastchar++ = *cp++) - continue; - *el->el_line.lastchar++ = pchar; - for (cp = &el->el_search.patbuf[LEN]; - cp < &el->el_search.patbuf[el->el_search.patlen]; - *el->el_line.lastchar++ = *cp++) - continue; - *el->el_line.lastchar = '\0'; - re_refresh(el); - - if (FUN(el,getc)(el, &ch) != 1) - return ed_end_of_file(el, 0); - - switch (el->el_map.current[(unsigned char) ch]) { - case ED_INSERT: - case ED_DIGIT: - if (el->el_search.patlen >= EL_BUFSIZ - LEN) - terminal_beep(el); - else { - el->el_search.patbuf[el->el_search.patlen++] = - ch; - *el->el_line.lastchar++ = ch; - *el->el_line.lastchar = '\0'; - re_refresh(el); - } - break; - - case EM_INC_SEARCH_NEXT: - newdir = ED_SEARCH_NEXT_HISTORY; - redo++; - break; - - case EM_INC_SEARCH_PREV: - newdir = ED_SEARCH_PREV_HISTORY; - redo++; - break; - - case EM_DELETE_PREV_CHAR: - case ED_DELETE_PREV_CHAR: - if (el->el_search.patlen > LEN) - done++; - else - terminal_beep(el); - break; - - default: - switch (ch) { - case 0007: /* ^G: Abort */ - ret = CC_ERROR; - done++; - break; - - case 0027: /* ^W: Append word */ - /* No can do if globbing characters in pattern */ - for (cp = &el->el_search.patbuf[LEN];; cp++) - if (cp >= &el->el_search.patbuf[ - el->el_search.patlen]) { - el->el_line.cursor += - el->el_search.patlen - LEN - 1; - cp = c__next_word(el->el_line.cursor, - el->el_line.lastchar, 1, - ce__isword); - while (el->el_line.cursor < cp && - *el->el_line.cursor != '\n') { - if (el->el_search.patlen >= - EL_BUFSIZ - LEN) { - terminal_beep(el); - break; - } - el->el_search.patbuf[el->el_search.patlen++] = - *el->el_line.cursor; - *el->el_line.lastchar++ = - *el->el_line.cursor++; - } - el->el_line.cursor = ocursor; - *el->el_line.lastchar = '\0'; - re_refresh(el); - break; - } else if (isglob(*cp)) { - terminal_beep(el); - break; - } - break; - - default: /* Terminate and execute cmd */ - endcmd[0] = ch; - FUN(el,push)(el, endcmd); - /* FALLTHROUGH */ - - case 0033: /* ESC: Terminate */ - ret = CC_REFRESH; - done++; - break; - } - break; - } - - while (el->el_line.lastchar > el->el_line.buffer && - *el->el_line.lastchar != '\n') - *el->el_line.lastchar-- = '\0'; - *el->el_line.lastchar = '\0'; - - if (!done) { - - /* Can't search if unmatched '[' */ - for (cp = &el->el_search.patbuf[el->el_search.patlen-1], - ch = ']'; - cp >= &el->el_search.patbuf[LEN]; - cp--) - if (*cp == '[' || *cp == ']') { - ch = *cp; - break; - } - if (el->el_search.patlen > LEN && ch != '[') { - if (redo && newdir == dir) { - if (pchar == '?') { /* wrap around */ - el->el_history.eventno = - newdir == ED_SEARCH_PREV_HISTORY ? 0 : 0x7fffffff; - if (hist_get(el) == CC_ERROR) - /* el->el_history.event - * no was fixed by - * first call */ - (void) hist_get(el); - el->el_line.cursor = newdir == - ED_SEARCH_PREV_HISTORY ? - el->el_line.lastchar : - el->el_line.buffer; - } else - el->el_line.cursor += - newdir == - ED_SEARCH_PREV_HISTORY ? - -1 : 1; - } -#ifdef ANCHOR - el->el_search.patbuf[el->el_search.patlen++] = - '.'; - el->el_search.patbuf[el->el_search.patlen++] = - '*'; -#endif - el->el_search.patbuf[el->el_search.patlen] = - '\0'; - if (el->el_line.cursor < el->el_line.buffer || - el->el_line.cursor > el->el_line.lastchar || - (ret = ce_search_line(el, newdir)) - == CC_ERROR) { - /* avoid c_setpat */ - el->el_state.lastcmd = - (el_action_t) newdir; - ret = (el_action_t) - (newdir == ED_SEARCH_PREV_HISTORY ? - ed_search_prev_history(el, 0) : - ed_search_next_history(el, 0)); - if (ret != CC_ERROR) { - el->el_line.cursor = newdir == - ED_SEARCH_PREV_HISTORY ? - el->el_line.lastchar : - el->el_line.buffer; - (void) ce_search_line(el, - newdir); - } - } - el->el_search.patlen -= LEN; - el->el_search.patbuf[el->el_search.patlen] = - '\0'; - if (ret == CC_ERROR) { - terminal_beep(el); - if (el->el_history.eventno != - ohisteventno) { - el->el_history.eventno = - ohisteventno; - if (hist_get(el) == CC_ERROR) - return CC_ERROR; - } - el->el_line.cursor = ocursor; - pchar = '?'; - } else { - pchar = ':'; - } - } - ret = ce_inc_search(el, newdir); - - if (ret == CC_ERROR && pchar == '?' && oldpchar == ':') - /* - * break abort of failed search at last - * non-failed - */ - ret = CC_NORM; - - } - if (ret == CC_NORM || (ret == CC_ERROR && oldpatlen == 0)) { - /* restore on normal return or error exit */ - pchar = oldpchar; - el->el_search.patlen = oldpatlen; - if (el->el_history.eventno != ohisteventno) { - el->el_history.eventno = ohisteventno; - if (hist_get(el) == CC_ERROR) - return CC_ERROR; - } - el->el_line.cursor = ocursor; - if (ret == CC_ERROR) - re_refresh(el); - } - if (done || ret != CC_NORM) - return ret; - } -} - - -/* cv_search(): - * Vi search. - */ -protected el_action_t -cv_search(EditLine *el, int dir) -{ - Char ch; - Char tmpbuf[EL_BUFSIZ]; - ssize_t tmplen; - -#ifdef ANCHOR - tmpbuf[0] = '.'; - tmpbuf[1] = '*'; -#endif - tmplen = LEN; - - el->el_search.patdir = dir; - - tmplen = c_gets(el, &tmpbuf[LEN], - dir == ED_SEARCH_PREV_HISTORY ? STR("\n/") : STR("\n?") ); - if (tmplen == -1) - return CC_REFRESH; - - tmplen += LEN; - ch = tmpbuf[tmplen]; - tmpbuf[tmplen] = '\0'; - - if (tmplen == LEN) { - /* - * Use the old pattern, but wild-card it. - */ - if (el->el_search.patlen == 0) { - re_refresh(el); - return CC_ERROR; - } -#ifdef ANCHOR - if (el->el_search.patbuf[0] != '.' && - el->el_search.patbuf[0] != '*') { - (void) Strncpy(tmpbuf, el->el_search.patbuf, - sizeof(tmpbuf) / sizeof(*tmpbuf) - 1); - el->el_search.patbuf[0] = '.'; - el->el_search.patbuf[1] = '*'; - (void) Strncpy(&el->el_search.patbuf[2], tmpbuf, - EL_BUFSIZ - 3); - el->el_search.patlen++; - el->el_search.patbuf[el->el_search.patlen++] = '.'; - el->el_search.patbuf[el->el_search.patlen++] = '*'; - el->el_search.patbuf[el->el_search.patlen] = '\0'; - } -#endif - } else { -#ifdef ANCHOR - tmpbuf[tmplen++] = '.'; - tmpbuf[tmplen++] = '*'; -#endif - tmpbuf[tmplen] = '\0'; - (void) Strncpy(el->el_search.patbuf, tmpbuf, EL_BUFSIZ - 1); - el->el_search.patlen = (size_t)tmplen; - } - 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) { - re_refresh(el); - return CC_ERROR; - } - if (ch == 0033) { - re_refresh(el); - return ed_newline(el, 0); - } - return CC_REFRESH; -} - - -/* ce_search_line(): - * Look for a pattern inside a line - */ -protected el_action_t -ce_search_line(EditLine *el, int dir) -{ - Char *cp = el->el_line.cursor; - Char *pattern = el->el_search.patbuf; - Char oc, *ocp; -#ifdef ANCHOR - ocp = &pattern[1]; - oc = *ocp; - *ocp = '^'; -#else - ocp = pattern; - oc = *ocp; -#endif - - if (dir == ED_SEARCH_PREV_HISTORY) { - for (; cp >= el->el_line.buffer; cp--) { - if (el_match(cp, ocp)) { - *ocp = oc; - el->el_line.cursor = cp; - return CC_NORM; - } - } - *ocp = oc; - return CC_ERROR; - } else { - for (; *cp != '\0' && cp < el->el_line.limit; cp++) { - if (el_match(cp, ocp)) { - *ocp = oc; - el->el_line.cursor = cp; - return CC_NORM; - } - } - *ocp = oc; - return CC_ERROR; - } -} - - -/* cv_repeat_srch(): - * Vi repeat search - */ -protected el_action_t -cv_repeat_srch(EditLine *el, Int c) -{ - -#ifdef SDEBUG - (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", - c, el->el_search.patlen, ct_encode_string(el->el_search.patbuf)); -#endif - - el->el_state.lastcmd = (el_action_t) c; /* Hack to stop c_setpat */ - el->el_line.lastchar = el->el_line.buffer; - - switch (c) { - case ED_SEARCH_NEXT_HISTORY: - return ed_search_next_history(el, 0); - case ED_SEARCH_PREV_HISTORY: - return ed_search_prev_history(el, 0); - default: - return CC_ERROR; - } -} - - -/* cv_csearch(): - * Vi character search - */ -protected el_action_t -cv_csearch(EditLine *el, int direction, Int ch, int count, int tflag) -{ - Char *cp; - - if (ch == 0) - return CC_ERROR; - - if (ch == (Int)-1) { - Char c; - if (FUN(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 = (char)tflag; - - cp = el->el_line.cursor; - while (count--) { - if ((Int)*cp == ch) - cp += direction; - for (;;cp += direction) { - if (cp >= el->el_line.lastchar) - return CC_ERROR; - if (cp < el->el_line.buffer) - return CC_ERROR; - if ((Int)*cp == ch) - break; - } - } - - if (tflag) - cp -= direction; - - el->el_line.cursor = cp; - - if (el->el_chared.c_vcmd.action != NOP) { - if (direction > 0) - el->el_line.cursor++; - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} diff --git a/cmd-line-utils/libedit/search.h b/cmd-line-utils/libedit/search.h deleted file mode 100644 index d9f27e56185..00000000000 --- a/cmd-line-utils/libedit/search.h +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: search.h,v 1.9 2009/12/30 22:37:40 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)search.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.search.h: Line and history searching utilities - */ -#ifndef _h_el_search -#define _h_el_search - -#include "histedit.h" - -typedef struct el_search_t { - Char *patbuf; /* The pattern buffer */ - size_t patlen; /* Length of the pattern buffer */ - 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; - - -protected int el_match(const Char *, const Char *); -protected int search_init(EditLine *); -protected void search_end(EditLine *); -protected int c_hmatch(EditLine *, const Char *); -protected void c_setpat(EditLine *); -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 *, int); -protected el_action_t cv_repeat_srch(EditLine *, Int); -protected el_action_t cv_csearch(EditLine *, int, Int, int, int); - -#endif /* _h_el_search */ diff --git a/cmd-line-utils/libedit/sig.c b/cmd-line-utils/libedit/sig.c deleted file mode 100644 index 986ad5792e2..00000000000 --- a/cmd-line-utils/libedit/sig.c +++ /dev/null @@ -1,199 +0,0 @@ -/* $NetBSD: sig.c,v 1.17 2011/07/28 20:50:55 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93"; -#else -#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 "el.h" -#include - -private EditLine *sel = NULL; - -private const int sighdl[] = { -#define _DO(a) (a), - ALLSIGS -#undef _DO - - 1 -}; - -private void sig_handler(int); - -/* sig_handler(): - * This is the handler called for all signals - * XXX: we cannot pass any data so we just store the old editline - * state in a private variable - */ -private void -sig_handler(int signo) -{ - int i; - sigset_t nset, oset; - - (void) sigemptyset(&nset); - (void) sigaddset(&nset, signo); - (void) sigprocmask(SIG_BLOCK, &nset, &oset); - - sel->el_signal->sig_no = signo; - - switch (signo) { - case SIGCONT: - tty_rawmode(sel); - if (ed_redisplay(sel, 0) == CC_REFRESH) - re_refresh(sel); - terminal__flush(sel); - break; - - case SIGWINCH: - el_resize(sel); - break; - - default: - tty_cookedmode(sel); - break; - } - - for (i = 0; sighdl[i] != -1; i++) - if (signo == sighdl[i]) - break; - - (void) sigaction(signo, &sel->el_signal->sig_action[i], NULL); - sel->el_signal->sig_action[i].sa_handler = SIG_ERR; - sel->el_signal->sig_action[i].sa_flags = 0; - sigemptyset(&sel->el_signal->sig_action[i].sa_mask); - (void) sigprocmask(SIG_SETMASK, &oset, NULL); - (void) kill(0, signo); -} - - -/* sig_init(): - * Initialize all signal stuff - */ -protected int -sig_init(EditLine *el) -{ - size_t i; - sigset_t *nset, oset; - - el->el_signal = el_malloc(sizeof(*el->el_signal)); - if (el->el_signal == NULL) - return -1; - - nset = &el->el_signal->sig_set; - (void) sigemptyset(nset); -#define _DO(a) (void) sigaddset(nset, a); - ALLSIGS -#undef _DO - (void) sigprocmask(SIG_BLOCK, nset, &oset); - - for (i = 0; sighdl[i] != -1; i++) { - el->el_signal->sig_action[i].sa_handler = SIG_ERR; - el->el_signal->sig_action[i].sa_flags = 0; - sigemptyset(&el->el_signal->sig_action[i].sa_mask); - } - - (void) sigprocmask(SIG_SETMASK, &oset, NULL); - - return 0; -} - - -/* sig_end(): - * Clear all signal stuff - */ -protected void -sig_end(EditLine *el) -{ - - el_free(el->el_signal); - el->el_signal = NULL; -} - - -/* sig_set(): - * set all the signal handlers - */ -protected void -sig_set(EditLine *el) -{ - size_t i; - sigset_t oset; - struct sigaction osa, nsa; - - nsa.sa_handler = sig_handler; - nsa.sa_flags = 0; - sigemptyset(&nsa.sa_mask); - - (void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset); - - for (i = 0; sighdl[i] != -1; i++) { - /* This could happen if we get interrupted */ - if (sigaction(sighdl[i], &nsa, &osa) != -1 && - osa.sa_handler != sig_handler) - el->el_signal->sig_action[i] = osa; - } - sel = el; - (void) sigprocmask(SIG_SETMASK, &oset, NULL); -} - - -/* sig_clr(): - * clear all the signal handlers - */ -protected void -sig_clr(EditLine *el) -{ - size_t i; - sigset_t oset; - - (void) sigprocmask(SIG_BLOCK, &el->el_signal->sig_set, &oset); - - for (i = 0; sighdl[i] != -1; i++) - if (el->el_signal->sig_action[i].sa_handler != SIG_ERR) - (void)sigaction(sighdl[i], - &el->el_signal->sig_action[i], NULL); - - sel = NULL; /* we are going to die if the handler is - * called */ - (void)sigprocmask(SIG_SETMASK, &oset, NULL); -} diff --git a/cmd-line-utils/libedit/sig.h b/cmd-line-utils/libedit/sig.h deleted file mode 100644 index c957cfdf5a7..00000000000 --- a/cmd-line-utils/libedit/sig.h +++ /dev/null @@ -1,72 +0,0 @@ -/* $NetBSD: sig.h,v 1.8 2009/02/19 15:20:22 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sig.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.sig.h: Signal handling functions - */ -#ifndef _h_el_sig -#define _h_el_sig - -#include - -#include "histedit.h" - -/* - * Define here all the signals we are going to handle - * The _DO macro is used to iterate in the source code - */ -#define ALLSIGS \ - _DO(SIGINT) \ - _DO(SIGTSTP) \ - _DO(SIGQUIT) \ - _DO(SIGHUP) \ - _DO(SIGTERM) \ - _DO(SIGCONT) \ - _DO(SIGWINCH) -#define ALLSIGSNO 7 - -typedef struct { - struct sigaction sig_action[ALLSIGSNO]; - sigset_t sig_set; - volatile sig_atomic_t sig_no; -} *el_signal_t; - -protected void sig_end(EditLine*); -protected int sig_init(EditLine*); -protected void sig_set(EditLine*); -protected void sig_clr(EditLine*); - -#endif /* _h_el_sig */ diff --git a/cmd-line-utils/libedit/sys.h b/cmd-line-utils/libedit/sys.h deleted file mode 100644 index af55bcd7202..00000000000 --- a/cmd-line-utils/libedit/sys.h +++ /dev/null @@ -1,187 +0,0 @@ -/* $NetBSD: sys.h,v 1.17 2011/09/28 14:08:04 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sys.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * sys.h: Put all the stupid compiler and system dependencies here... - */ -#ifndef _h_sys -#define _h_sys - -#ifdef __linux__ -/* Apparently we need _GNU_SOURCE defined to get access to wcsdup on Linux */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#endif - -#ifndef __USE_XOPEN -#define __USE_XOPEN -#endif - -#ifdef HAVE_SYS_CDEFS_H -#include -#endif - -#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) -# define __attribute__(A) -#endif - -#ifndef __BEGIN_DECLS -# ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -# else -# define __BEGIN_DECLS -# define __END_DECLS -# endif -#endif - -#ifndef public -# define public /* Externally visible functions/variables */ -#endif - -#ifndef private -# define private static /* Always hidden internals */ -#endif - -#ifndef protected -# define protected /* Redefined from elsewhere to "static" */ - /* When we want to hide everything */ -#endif - -#ifndef __arraycount -# define __arraycount(a) (sizeof(a) / sizeof(*(a))) -#endif - -#include - -#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 - -#include -#include - -#ifndef HAVE_WCSDUP -wchar_t *wcsdup(const wchar_t *); -#endif - -#ifndef _DIAGASSERT -#define _DIAGASSERT(x) -#endif - -#ifndef __RCSID -#define __RCSID(x) -#endif - -#ifndef HAVE_U_INT32_T -typedef unsigned int u_int32_t; -#endif - -#ifndef SIZE_T_MAX -#define SIZE_T_MAX ((size_t)-1) -#endif - -#define REGEX /* Use POSIX.2 regular expression functions */ -#undef REGEXP /* Use UNIX V8 regular expression functions */ - -#if defined(__sun) -extern int tgetent(char *, const char *); -extern int tgetflag(char *); -extern int tgetnum(char *); -extern int tputs(const char *, int, int (*)(int)); -extern char* tgoto(const char*, int, int); -extern char* tgetstr(char*, char**); -#endif - -/* XXXMYSQL: Bug#10218 Command line recall rolls into segfault */ -#if !HAVE_DECL_TGOTO -/* - 'tgoto' is not declared in the system header files, this causes - problems on 64-bit systems. The function returns a 64 bit pointer - but caller see it as "int" and it's thus truncated to 32-bit -*/ -extern char* tgoto(const char*, int, int); -#endif - -#ifdef notdef -# undef REGEX -# undef REGEXP -# include -# 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 -# define strerror(e) sys_errlist[e] -# endif -# ifdef SABER -extern void * memcpy(void *, const void *, size_t); -extern void * memset(void *, int, size_t); -# endif -extern char *fgetline(FILE *, int *); -#endif - -#endif /* _h_sys */ diff --git a/cmd-line-utils/libedit/terminal.c b/cmd-line-utils/libedit/terminal.c deleted file mode 100644 index fb5600a4140..00000000000 --- a/cmd-line-utils/libedit/terminal.c +++ /dev/null @@ -1,1677 +0,0 @@ -/* $NetBSD: terminal.c,v 1.10 2011/10/04 15:27:04 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * terminal.c: Editor/termcap-curses interface - * We have to declare a static variable here, since the - * termcap putchar routine does not take an argument! - */ -#include -#include -#include -#include -#include -#include -#if 0 /* TODO: do we need this */ -#ifdef HAVE_TERMCAP_H -#include -#endif -#endif -#ifdef HAVE_CURSES_H -#include -#elif HAVE_NCURSES_H -#include -#endif - -/* Solaris's term.h does horrid things. */ -#if defined(HAVE_TERM_H) && !defined(__sun) -#include -#endif - -#include -#include - -#ifdef _REENTRANT -#include -#endif - -#include "el.h" - -/* - * IMPORTANT NOTE: these routines are allowed to look at the current screen - * and the current position assuming that it is correct. If this is not - * true, then the update will be WRONG! This is (should be) a valid - * assumption... - */ - -#define TC_BUFSIZE ((size_t)2048) - -#define GoodStr(a) (el->el_terminal.t_str[a] != NULL && \ - el->el_terminal.t_str[a][0] != '\0') -#define Str(a) el->el_terminal.t_str[a] -#define Val(a) el->el_terminal.t_val[a] - -private const struct termcapstr { - const char *name; - const char *long_name; -} tstr[] = { -#define T_al 0 - { "al", "add new blank line" }, -#define T_bl 1 - { "bl", "audible bell" }, -#define T_cd 2 - { "cd", "clear to bottom" }, -#define T_ce 3 - { "ce", "clear to end of line" }, -#define T_ch 4 - { "ch", "cursor to horiz pos" }, -#define T_cl 5 - { "cl", "clear screen" }, -#define T_dc 6 - { "dc", "delete a character" }, -#define T_dl 7 - { "dl", "delete a line" }, -#define T_dm 8 - { "dm", "start delete mode" }, -#define T_ed 9 - { "ed", "end delete mode" }, -#define T_ei 10 - { "ei", "end insert mode" }, -#define T_fs 11 - { "fs", "cursor from status line" }, -#define T_ho 12 - { "ho", "home cursor" }, -#define T_ic 13 - { "ic", "insert character" }, -#define T_im 14 - { "im", "start insert mode" }, -#define T_ip 15 - { "ip", "insert padding" }, -#define T_kd 16 - { "kd", "sends cursor down" }, -#define T_kl 17 - { "kl", "sends cursor left" }, -#define T_kr 18 - { "kr", "sends cursor right" }, -#define T_ku 19 - { "ku", "sends cursor up" }, -#define T_md 20 - { "md", "begin bold" }, -#define T_me 21 - { "me", "end attributes" }, -#define T_nd 22 - { "nd", "non destructive space" }, -#define T_se 23 - { "se", "end standout" }, -#define T_so 24 - { "so", "begin standout" }, -#define T_ts 25 - { "ts", "cursor to status line" }, -#define T_up 26 - { "up", "cursor up one" }, -#define T_us 27 - { "us", "begin underline" }, -#define T_ue 28 - { "ue", "end underline" }, -#define T_vb 29 - { "vb", "visible bell" }, -#define T_DC 30 - { "DC", "delete multiple chars" }, -#define T_DO 31 - { "DO", "cursor down multiple" }, -#define T_IC 32 - { "IC", "insert multiple chars" }, -#define T_LE 33 - { "LE", "cursor left multiple" }, -#define T_RI 34 - { "RI", "cursor right multiple" }, -#define T_UP 35 - { "UP", "cursor up multiple" }, -#define T_kh 36 - { "kh", "send cursor home" }, -#define T_at7 37 - { "@7", "send cursor end" }, -#define T_str 38 - { NULL, NULL } -}; - -private const struct termcapval { - const char *name; - const char *long_name; -} tval[] = { -#define T_am 0 - { "am", "has automatic margins" }, -#define T_pt 1 - { "pt", "has physical tabs" }, -#define T_li 2 - { "li", "Number of lines" }, -#define T_co 3 - { "co", "Number of columns" }, -#define T_km 4 - { "km", "Has meta key" }, -#define T_xt 5 - { "xt", "Tab chars destructive" }, -#define T_xn 6 - { "xn", "newline ignored at right margin" }, -#define T_MT 7 - { "MT", "Has meta key" }, /* XXX? */ -#define T_val 8 - { NULL, NULL, } -}; -/* do two or more of the attributes use me */ - -private void terminal_setflags(EditLine *); -private int terminal_rebuffer_display(EditLine *); -private void terminal_free_display(EditLine *); -private int terminal_alloc_display(EditLine *); -private void terminal_alloc(EditLine *, const struct termcapstr *, - const char *); -private void terminal_init_arrow(EditLine *); -private void terminal_reset_arrow(EditLine *); -private int terminal_putc(int); -private void terminal_tputs(EditLine *, const char *, int); - -#ifdef _REENTRANT -private pthread_mutex_t terminal_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif -private FILE *terminal_outfile = NULL; - - -/* terminal_setflags(): - * Set the terminal capability flags - */ -private void -terminal_setflags(EditLine *el) -{ - EL_FLAGS = 0; - if (el->el_tty.t_tabs) - EL_FLAGS |= (Val(T_pt) && !Val(T_xt)) ? TERM_CAN_TAB : 0; - - EL_FLAGS |= (Val(T_km) || Val(T_MT)) ? TERM_HAS_META : 0; - EL_FLAGS |= GoodStr(T_ce) ? TERM_CAN_CEOL : 0; - EL_FLAGS |= (GoodStr(T_dc) || GoodStr(T_DC)) ? TERM_CAN_DELETE : 0; - EL_FLAGS |= (GoodStr(T_im) || GoodStr(T_ic) || GoodStr(T_IC)) ? - TERM_CAN_INSERT : 0; - EL_FLAGS |= (GoodStr(T_up) || GoodStr(T_UP)) ? TERM_CAN_UP : 0; - EL_FLAGS |= Val(T_am) ? TERM_HAS_AUTO_MARGINS : 0; - EL_FLAGS |= Val(T_xn) ? TERM_HAS_MAGIC_MARGINS : 0; - - if (GoodStr(T_me) && GoodStr(T_ue)) - EL_FLAGS |= (strcmp(Str(T_me), Str(T_ue)) == 0) ? - TERM_CAN_ME : 0; - else - EL_FLAGS &= ~TERM_CAN_ME; - if (GoodStr(T_me) && GoodStr(T_se)) - EL_FLAGS |= (strcmp(Str(T_me), Str(T_se)) == 0) ? - TERM_CAN_ME : 0; - - -#ifdef DEBUG_SCREEN - if (!EL_CAN_UP) { - (void) fprintf(el->el_errfile, - "WARNING: Your terminal cannot move up.\n"); - (void) fprintf(el->el_errfile, - "Editing may be odd for long lines.\n"); - } - if (!EL_CAN_CEOL) - (void) fprintf(el->el_errfile, "no clear EOL capability.\n"); - if (!EL_CAN_DELETE) - (void) fprintf(el->el_errfile, "no delete char capability.\n"); - if (!EL_CAN_INSERT) - (void) fprintf(el->el_errfile, "no insert char capability.\n"); -#endif /* DEBUG_SCREEN */ -} - -/* terminal_init(): - * Initialize the terminal stuff - */ -protected int -terminal_init(EditLine *el) -{ - - el->el_terminal.t_buf = el_malloc(TC_BUFSIZE * - sizeof(*el->el_terminal.t_buf)); - if (el->el_terminal.t_buf == NULL) - return -1; - el->el_terminal.t_cap = el_malloc(TC_BUFSIZE * - sizeof(*el->el_terminal.t_cap)); - if (el->el_terminal.t_cap == NULL) - return -1; - el->el_terminal.t_fkey = el_malloc(A_K_NKEYS * - sizeof(*el->el_terminal.t_fkey)); - if (el->el_terminal.t_fkey == NULL) - return -1; - el->el_terminal.t_loc = 0; - el->el_terminal.t_str = el_malloc(T_str * - sizeof(*el->el_terminal.t_str)); - if (el->el_terminal.t_str == NULL) - return -1; - (void) memset(el->el_terminal.t_str, 0, T_str * - sizeof(*el->el_terminal.t_str)); - el->el_terminal.t_val = el_malloc(T_val * - sizeof(*el->el_terminal.t_val)); - if (el->el_terminal.t_val == NULL) - return -1; - (void) memset(el->el_terminal.t_val, 0, T_val * - sizeof(*el->el_terminal.t_val)); - (void) terminal_set(el, NULL); - terminal_init_arrow(el); - return 0; -} - -/* terminal_end(): - * Clean up the terminal stuff - */ -protected void -terminal_end(EditLine *el) -{ - - el_free(el->el_terminal.t_buf); - el->el_terminal.t_buf = NULL; - el_free(el->el_terminal.t_cap); - el->el_terminal.t_cap = NULL; - el->el_terminal.t_loc = 0; - el_free(el->el_terminal.t_str); - el->el_terminal.t_str = NULL; - el_free(el->el_terminal.t_val); - el->el_terminal.t_val = NULL; - el_free(el->el_terminal.t_fkey); - el->el_terminal.t_fkey = NULL; - terminal_free_display(el); -} - - -/* terminal_alloc(): - * Maintain a string pool for termcap strings - */ -private void -terminal_alloc(EditLine *el, const struct termcapstr *t, const char *cap) -{ - char termbuf[TC_BUFSIZE]; - size_t tlen, clen; - char **tlist = el->el_terminal.t_str; - char **tmp, **str = &tlist[t - tstr]; - - if (cap == NULL || *cap == '\0') { - *str = NULL; - return; - } else - clen = strlen(cap); - - tlen = *str == NULL ? 0 : strlen(*str); - - /* - * New string is shorter; no need to allocate space - */ - if (clen <= tlen) { - if (*str) - (void) strcpy(*str, cap); /* XXX strcpy is safe */ - return; - } - /* - * New string is longer; see if we have enough space to append - */ - if (el->el_terminal.t_loc + 3 < TC_BUFSIZE) { - /* XXX strcpy is safe */ - (void) strcpy(*str = &el->el_terminal.t_buf[ - el->el_terminal.t_loc], cap); - el->el_terminal.t_loc += clen + 1; /* one for \0 */ - return; - } - /* - * Compact our buffer; no need to check compaction, cause we know it - * fits... - */ - tlen = 0; - for (tmp = tlist; tmp < &tlist[T_str]; tmp++) - if (*tmp != NULL && *tmp != '\0' && *tmp != *str) { - char *ptr; - - for (ptr = *tmp; *ptr != '\0'; termbuf[tlen++] = *ptr++) - continue; - termbuf[tlen++] = '\0'; - } - memcpy(el->el_terminal.t_buf, termbuf, TC_BUFSIZE); - el->el_terminal.t_loc = tlen; - if (el->el_terminal.t_loc + 3 >= TC_BUFSIZE) { - (void) fprintf(el->el_errfile, - "Out of termcap string space.\n"); - return; - } - /* XXX strcpy is safe */ - (void) strcpy(*str = &el->el_terminal.t_buf[el->el_terminal.t_loc], - cap); - el->el_terminal.t_loc += (size_t)clen + 1; /* one for \0 */ - return; -} - - -/* terminal_rebuffer_display(): - * Rebuffer the display after the screen changed size - */ -private int -terminal_rebuffer_display(EditLine *el) -{ - coord_t *c = &el->el_terminal.t_size; - - terminal_free_display(el); - - c->h = Val(T_co); - c->v = Val(T_li); - - if (terminal_alloc_display(el) == -1) - return -1; - return 0; -} - - -/* terminal_alloc_display(): - * Allocate a new display. - */ -private int -terminal_alloc_display(EditLine *el) -{ - int i; - Char **b; - coord_t *c = &el->el_terminal.t_size; - - b = el_malloc(sizeof(*b) * (size_t)(c->v + 1)); - if (b == NULL) - return -1; - for (i = 0; i < c->v; i++) { - b[i] = el_malloc(sizeof(**b) * (size_t)(c->h + 1)); - if (b[i] == NULL) { - while (--i >= 0) - el_free(b[i]); - el_free(b); - return -1; - } - } - b[c->v] = NULL; - el->el_display = b; - - b = el_malloc(sizeof(*b) * (size_t)(c->v + 1)); - if (b == NULL) - return -1; - for (i = 0; i < c->v; i++) { - b[i] = el_malloc(sizeof(**b) * (size_t)(c->h + 1)); - if (b[i] == NULL) { - while (--i >= 0) - el_free(b[i]); - el_free(b); - return -1; - } - } - b[c->v] = NULL; - el->el_vdisplay = b; - return 0; -} - - -/* terminal_free_display(): - * Free the display buffers - */ -private void -terminal_free_display(EditLine *el) -{ - Char **b; - Char **bufp; - - b = el->el_display; - el->el_display = NULL; - if (b != NULL) { - for (bufp = b; *bufp != NULL; bufp++) - el_free(*bufp); - el_free(b); - } - b = el->el_vdisplay; - el->el_vdisplay = NULL; - if (b != NULL) { - for (bufp = b; *bufp != NULL; bufp++) - el_free(*bufp); - el_free(b); - } -} - - -/* terminal_move_to_line(): - * move to line (first line == 0) - * as efficiently as possible - */ -protected void -terminal_move_to_line(EditLine *el, int where) -{ - int del; - - if (where == el->el_cursor.v) - return; - - if (where > el->el_terminal.t_size.v) { -#ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, - "terminal_move_to_line: where is ridiculous: %d\r\n", - where); -#endif /* DEBUG_SCREEN */ - return; - } - if ((del = where - el->el_cursor.v) > 0) { - while (del > 0) { - if (EL_HAS_AUTO_MARGINS && - el->el_display[el->el_cursor.v][0] != '\0') { - size_t h = (size_t) - (el->el_terminal.t_size.h - 1); -#ifdef WIDECHAR - for (; h > 0 && - el->el_display[el->el_cursor.v][h] == - MB_FILL_CHAR; - h--) - continue; -#endif - /* move without newline */ - terminal_move_to_char(el, (int)h); - terminal_overwrite(el, &el->el_display - [el->el_cursor.v][el->el_cursor.h], - (size_t)(el->el_terminal.t_size.h - - el->el_cursor.h)); - /* updates Cursor */ - del--; - } else { - if ((del > 1) && GoodStr(T_DO)) { - terminal_tputs(el, tgoto(Str(T_DO), del, - del), del); - del = 0; - } else { - for (; del > 0; del--) - terminal__putc(el, '\n'); - /* because the \n will become \r\n */ - el->el_cursor.h = 0; - } - } - } - } else { /* del < 0 */ - if (GoodStr(T_UP) && (-del > 1 || !GoodStr(T_up))) - terminal_tputs(el, tgoto(Str(T_UP), -del, -del), -del); - else { - if (GoodStr(T_up)) - for (; del < 0; del++) - terminal_tputs(el, Str(T_up), 1); - } - } - el->el_cursor.v = where;/* now where is here */ -} - - -/* terminal_move_to_char(): - * Move to the character position specified - */ -protected void -terminal_move_to_char(EditLine *el, int where) -{ - int del, i; - -mc_again: - if (where == el->el_cursor.h) - return; - - if (where > el->el_terminal.t_size.h) { -#ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, - "terminal_move_to_char: where is riduculous: %d\r\n", - where); -#endif /* DEBUG_SCREEN */ - return; - } - if (!where) { /* if where is first column */ - terminal__putc(el, '\r'); /* do a CR */ - el->el_cursor.h = 0; - return; - } - del = where - el->el_cursor.h; - - if ((del < -4 || del > 4) && GoodStr(T_ch)) - /* go there directly */ - terminal_tputs(el, tgoto(Str(T_ch), where, where), where); - else { - if (del > 0) { /* moving forward */ - if ((del > 4) && GoodStr(T_RI)) - terminal_tputs(el, tgoto(Str(T_RI), del, del), - del); - else { - /* if I can do tabs, use them */ - if (EL_CAN_TAB) { - if ((el->el_cursor.h & 0370) != - (where & ~0x7) -#ifdef WIDECHAR - && (el->el_display[ - el->el_cursor.v][where & 0370] != - MB_FILL_CHAR) -#endif - ) { - /* if not within tab stop */ - for (i = - (el->el_cursor.h & 0370); - i < (where & ~0x7); - i += 8) - terminal__putc(el, - '\t'); - /* then tab over */ - el->el_cursor.h = where & ~0x7; - } - } - /* - * it's usually cheaper to just write the - * chars, so we do. - */ - /* - * NOTE THAT terminal_overwrite() WILL CHANGE - * el->el_cursor.h!!! - */ - terminal_overwrite(el, &el->el_display[ - el->el_cursor.v][el->el_cursor.h], - (size_t)(where - el->el_cursor.h)); - - } - } else { /* del < 0 := moving backward */ - if ((-del > 4) && GoodStr(T_LE)) - terminal_tputs(el, tgoto(Str(T_LE), -del, -del), - -del); - else { /* can't go directly there */ - /* - * if the "cost" is greater than the "cost" - * from col 0 - */ - if (EL_CAN_TAB ? - ((unsigned int)-del > - (((unsigned int) where >> 3) + - (where & 07))) - : (-del > where)) { - terminal__putc(el, '\r');/* do a CR */ - el->el_cursor.h = 0; - goto mc_again; /* and try again */ - } - for (i = 0; i < -del; i++) - terminal__putc(el, '\b'); - } - } - } - el->el_cursor.h = where; /* now where is here */ -} - - -/* terminal_overwrite(): - * Overstrike num characters - * Assumes MB_FILL_CHARs are present to keep the column count correct - */ -protected void -terminal_overwrite(EditLine *el, const Char *cp, size_t n) -{ -#ifdef WIDECHAR - int width; -#endif - - if (n == 0) - return; - - if (n > (size_t)el->el_terminal.t_size.h) { -#ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, - "terminal_overwrite: n is riduculous: %d\r\n", n); -#endif /* DEBUG_SCREEN */ - return; - } - - do { -#ifdef WIDECHAR - width = wcwidth(*cp); /* Returns -1 for faux character. */ - if (width != -1) - el->el_cursor.h += width; -#else - el->el_cursor.h++; -#endif - /* terminal__putc() ignores any MB_FILL_CHARs */ - terminal__putc(el, *cp++); - } while (--n); - - if (el->el_cursor.h >= el->el_terminal.t_size.h) { /* wrap? */ - if (EL_HAS_AUTO_MARGINS) { /* yes */ - el->el_cursor.h = 0; - el->el_cursor.v++; - if (EL_HAS_MAGIC_MARGINS) { - /* force the wrap to avoid the "magic" - * situation */ - Char c; - if ((c = el->el_display[el->el_cursor.v] - [el->el_cursor.h]) != '\0') { - terminal_overwrite(el, &c, (size_t)1); -#ifdef WIDECHAR - while (el->el_display[el->el_cursor.v] - [el->el_cursor.h] == MB_FILL_CHAR) - el->el_cursor.h++; -#endif - } else { - terminal__putc(el, ' '); - el->el_cursor.h = 1; - } - } - } else /* no wrap, but cursor stays on screen */ - el->el_cursor.h = el->el_terminal.t_size.h - 1; - } -} - - -/* terminal_deletechars(): - * Delete num characters - */ -protected void -terminal_deletechars(EditLine *el, int num) -{ - if (num <= 0) - return; - - if (!EL_CAN_DELETE) { -#ifdef DEBUG_EDIT - (void) fprintf(el->el_errfile, " ERROR: cannot delete \n"); -#endif /* DEBUG_EDIT */ - return; - } - if (num > el->el_terminal.t_size.h) { -#ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, - "terminal_deletechars: num is riduculous: %d\r\n", num); -#endif /* DEBUG_SCREEN */ - return; - } - if (GoodStr(T_DC)) /* if I have multiple delete */ - if ((num > 1) || !GoodStr(T_dc)) { /* if dc would be more - * expen. */ - terminal_tputs(el, tgoto(Str(T_DC), num, num), num); - return; - } - if (GoodStr(T_dm)) /* if I have delete mode */ - terminal_tputs(el, Str(T_dm), 1); - - if (GoodStr(T_dc)) /* else do one at a time */ - while (num--) - terminal_tputs(el, Str(T_dc), 1); - - if (GoodStr(T_ed)) /* if I have delete mode */ - terminal_tputs(el, Str(T_ed), 1); -} - - -/* terminal_insertwrite(): - * Puts terminal in insert character mode or inserts num - * characters in the line - * Assumes MB_FILL_CHARs are present to keep column count correct - */ -protected void -terminal_insertwrite(EditLine *el, Char *cp, int num) -{ - if (num <= 0) - return; - if (!EL_CAN_INSERT) { -#ifdef DEBUG_EDIT - (void) fprintf(el->el_errfile, " ERROR: cannot insert \n"); -#endif /* DEBUG_EDIT */ - return; - } - if (num > el->el_terminal.t_size.h) { -#ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, - "StartInsert: num is riduculous: %d\r\n", num); -#endif /* DEBUG_SCREEN */ - return; - } - if (GoodStr(T_IC)) /* if I have multiple insert */ - if ((num > 1) || !GoodStr(T_ic)) { - /* if ic would be more expensive */ - terminal_tputs(el, tgoto(Str(T_IC), num, num), num); - terminal_overwrite(el, cp, (size_t)num); - /* this updates el_cursor.h */ - return; - } - if (GoodStr(T_im) && GoodStr(T_ei)) { /* if I have insert mode */ - terminal_tputs(el, Str(T_im), 1); - - el->el_cursor.h += num; - do - terminal__putc(el, *cp++); - while (--num); - - if (GoodStr(T_ip)) /* have to make num chars insert */ - terminal_tputs(el, Str(T_ip), 1); - - terminal_tputs(el, Str(T_ei), 1); - return; - } - do { - if (GoodStr(T_ic)) /* have to make num chars insert */ - terminal_tputs(el, Str(T_ic), 1); - - terminal__putc(el, *cp++); - - el->el_cursor.h++; - - if (GoodStr(T_ip)) /* have to make num chars insert */ - terminal_tputs(el, Str(T_ip), 1); - /* pad the inserted char */ - - } while (--num); -} - - -/* terminal_clear_EOL(): - * clear to end of line. There are num characters to clear - */ -protected void -terminal_clear_EOL(EditLine *el, int num) -{ - int i; - - if (EL_CAN_CEOL && GoodStr(T_ce)) - terminal_tputs(el, Str(T_ce), 1); - else { - for (i = 0; i < num; i++) - terminal__putc(el, ' '); - el->el_cursor.h += num; /* have written num spaces */ - } -} - - -/* terminal_clear_screen(): - * Clear the screen - */ -protected void -terminal_clear_screen(EditLine *el) -{ /* clear the whole screen and home */ - - if (GoodStr(T_cl)) - /* send the clear screen code */ - terminal_tputs(el, Str(T_cl), Val(T_li)); - else if (GoodStr(T_ho) && GoodStr(T_cd)) { - terminal_tputs(el, Str(T_ho), Val(T_li)); /* home */ - /* clear to bottom of screen */ - terminal_tputs(el, Str(T_cd), Val(T_li)); - } else { - terminal__putc(el, '\r'); - terminal__putc(el, '\n'); - } -} - - -/* terminal_beep(): - * Beep the way the terminal wants us - */ -protected void -terminal_beep(EditLine *el) -{ - if (GoodStr(T_bl)) - /* what termcap says we should use */ - terminal_tputs(el, Str(T_bl), 1); - else - terminal__putc(el, '\007'); /* an ASCII bell; ^G */ -} - - -protected void -terminal_get(EditLine *el, const char **term) -{ - *term = el->el_terminal.t_name; -} - - -/* terminal_set(): - * Read in the terminal capabilities from the requested terminal - */ -protected int -terminal_set(EditLine *el, const char *term) -{ - int i; - char buf[TC_BUFSIZE]; - char *area; - const struct termcapstr *t; - sigset_t oset, nset; - int lins, cols; - - (void) sigemptyset(&nset); - (void) sigaddset(&nset, SIGWINCH); - (void) sigprocmask(SIG_BLOCK, &nset, &oset); - - area = buf; - - - if (term == NULL) - term = getenv("TERM"); - - if (!term || !term[0]) - term = "dumb"; - - if (strcmp(term, "emacs") == 0) - el->el_flags |= EDIT_DISABLED; - - memset(el->el_terminal.t_cap, 0, TC_BUFSIZE); - - i = tgetent(el->el_terminal.t_cap, term); - - if (i <= 0) { - if (i == -1) - (void) fprintf(el->el_errfile, - "Cannot read termcap database;\n"); - else if (i == 0) - (void) fprintf(el->el_errfile, - "No entry for terminal type \"%s\";\n", term); - (void) fprintf(el->el_errfile, - "using dumb terminal settings.\n"); - Val(T_co) = 80; /* do a dumb terminal */ - Val(T_pt) = Val(T_km) = Val(T_li) = 0; - Val(T_xt) = Val(T_MT); - for (t = tstr; t->name != NULL; t++) - terminal_alloc(el, t, NULL); - } else { - /* auto/magic margins */ - Val(T_am) = tgetflag((char*) "am"); - Val(T_xn) = tgetflag((char*) "xn"); - /* Can we tab */ - Val(T_pt) = tgetflag((char*) "pt"); - Val(T_xt) = tgetflag((char*) "xt"); - /* do we have a meta? */ - Val(T_km) = tgetflag((char*) "km"); - Val(T_MT) = tgetflag((char*) "MT"); - /* Get the size */ - Val(T_co) = tgetnum((char*) "co"); - Val(T_li) = tgetnum((char*) "li"); - for (t = tstr; t->name != NULL; t++) { - /* XXX: some systems' tgetstr needs non const */ - terminal_alloc(el, t, tgetstr(strchr(t->name, *t->name), - &area)); - } - } - - if (Val(T_co) < 2) - Val(T_co) = 80; /* just in case */ - if (Val(T_li) < 1) - Val(T_li) = 24; - - el->el_terminal.t_size.v = Val(T_co); - el->el_terminal.t_size.h = Val(T_li); - - terminal_setflags(el); - - /* get the correct window size */ - (void) terminal_get_size(el, &lins, &cols); - if (terminal_change_size(el, lins, cols) == -1) - return -1; - (void) sigprocmask(SIG_SETMASK, &oset, NULL); - terminal_bind_arrow(el); - el->el_terminal.t_name = term; - return i <= 0 ? -1 : 0; -} - - -/* terminal_get_size(): - * Return the new window size in lines and cols, and - * true if the size was changed. - */ -protected int -terminal_get_size(EditLine *el, int *lins, int *cols) -{ - - *cols = Val(T_co); - *lins = Val(T_li); - -#ifdef TIOCGWINSZ - { - struct winsize ws; - if (ioctl(el->el_infd, TIOCGWINSZ, &ws) != -1) { - if (ws.ws_col) - *cols = ws.ws_col; - if (ws.ws_row) - *lins = ws.ws_row; - } - } -#endif -#ifdef TIOCGSIZE - { - struct ttysize ts; - if (ioctl(el->el_infd, TIOCGSIZE, &ts) != -1) { - if (ts.ts_cols) - *cols = ts.ts_cols; - if (ts.ts_lines) - *lins = ts.ts_lines; - } - } -#endif - return Val(T_co) != *cols || Val(T_li) != *lins; -} - - -/* terminal_change_size(): - * Change the size of the terminal - */ -protected int -terminal_change_size(EditLine *el, int lins, int cols) -{ - /* - * Just in case - */ - Val(T_co) = (cols < 2) ? 80 : cols; - Val(T_li) = (lins < 1) ? 24 : lins; - - /* re-make display buffers */ - if (terminal_rebuffer_display(el) == -1) - return -1; - re_clear_display(el); - return 0; -} - - -/* terminal_init_arrow(): - * Initialize the arrow key bindings from termcap - */ -private void -terminal_init_arrow(EditLine *el) -{ - funckey_t *arrow = el->el_terminal.t_fkey; - - arrow[A_K_DN].name = STR("down"); - arrow[A_K_DN].key = T_kd; - arrow[A_K_DN].fun.cmd = ED_NEXT_HISTORY; - arrow[A_K_DN].type = XK_CMD; - - arrow[A_K_UP].name = STR("up"); - arrow[A_K_UP].key = T_ku; - arrow[A_K_UP].fun.cmd = ED_PREV_HISTORY; - arrow[A_K_UP].type = XK_CMD; - - arrow[A_K_LT].name = STR("left"); - arrow[A_K_LT].key = T_kl; - arrow[A_K_LT].fun.cmd = ED_PREV_CHAR; - arrow[A_K_LT].type = XK_CMD; - - arrow[A_K_RT].name = STR("right"); - arrow[A_K_RT].key = T_kr; - arrow[A_K_RT].fun.cmd = ED_NEXT_CHAR; - arrow[A_K_RT].type = XK_CMD; - - arrow[A_K_HO].name = STR("home"); - arrow[A_K_HO].key = T_kh; - arrow[A_K_HO].fun.cmd = ED_MOVE_TO_BEG; - arrow[A_K_HO].type = XK_CMD; - - arrow[A_K_EN].name = STR("end"); - arrow[A_K_EN].key = T_at7; - arrow[A_K_EN].fun.cmd = ED_MOVE_TO_END; - arrow[A_K_EN].type = XK_CMD; -} - - -/* terminal_reset_arrow(): - * Reset arrow key bindings - */ -private void -terminal_reset_arrow(EditLine *el) -{ - funckey_t *arrow = el->el_terminal.t_fkey; - static const Char strA[] = {033, '[', 'A', '\0'}; - static const Char strB[] = {033, '[', 'B', '\0'}; - static const Char strC[] = {033, '[', 'C', '\0'}; - static const Char strD[] = {033, '[', 'D', '\0'}; - static const Char strH[] = {033, '[', 'H', '\0'}; - static const Char strF[] = {033, '[', 'F', '\0'}; - static const Char stOA[] = {033, 'O', 'A', '\0'}; - static const Char stOB[] = {033, 'O', 'B', '\0'}; - static const Char stOC[] = {033, 'O', 'C', '\0'}; - static const Char stOD[] = {033, 'O', 'D', '\0'}; - static const Char stOH[] = {033, 'O', 'H', '\0'}; - static const Char stOF[] = {033, 'O', 'F', '\0'}; - - keymacro_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); - keymacro_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); - keymacro_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type); - keymacro_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type); - keymacro_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type); - keymacro_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type); - keymacro_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); - keymacro_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); - keymacro_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type); - keymacro_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type); - keymacro_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type); - keymacro_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type); - - if (el->el_map.type != MAP_VI) - return; - keymacro_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type); - keymacro_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type); - keymacro_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type); - keymacro_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type); - keymacro_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type); - keymacro_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type); - keymacro_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type); - keymacro_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type); - keymacro_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type); - keymacro_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type); - keymacro_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type); - keymacro_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type); -} - - -/* terminal_set_arrow(): - * Set an arrow key binding - */ -protected int -terminal_set_arrow(EditLine *el, const Char *name, keymacro_value_t *fun, - int type) -{ - funckey_t *arrow = el->el_terminal.t_fkey; - int i; - - for (i = 0; i < A_K_NKEYS; i++) - if (Strcmp(name, arrow[i].name) == 0) { - arrow[i].fun = *fun; - arrow[i].type = type; - return 0; - } - return -1; -} - - -/* terminal_clear_arrow(): - * Clear an arrow key binding - */ -protected int -terminal_clear_arrow(EditLine *el, const Char *name) -{ - funckey_t *arrow = el->el_terminal.t_fkey; - int i; - - for (i = 0; i < A_K_NKEYS; i++) - if (Strcmp(name, arrow[i].name) == 0) { - arrow[i].type = XK_NOD; - return 0; - } - return -1; -} - - -/* terminal_print_arrow(): - * Print the arrow key bindings - */ -protected void -terminal_print_arrow(EditLine *el, const Char *name) -{ - int i; - funckey_t *arrow = el->el_terminal.t_fkey; - - for (i = 0; i < A_K_NKEYS; i++) - if (*name == '\0' || Strcmp(name, arrow[i].name) == 0) - if (arrow[i].type != XK_NOD) - keymacro_kprint(el, arrow[i].name, - &arrow[i].fun, arrow[i].type); -} - - -/* terminal_bind_arrow(): - * Bind the arrow keys - */ -protected void -terminal_bind_arrow(EditLine *el) -{ - el_action_t *map; - const el_action_t *dmap; - int i, j; - char *p; - funckey_t *arrow = el->el_terminal.t_fkey; - - /* Check if the components needed are initialized */ - if (el->el_terminal.t_buf == NULL || el->el_map.key == NULL) - return; - - map = el->el_map.type == MAP_VI ? el->el_map.alt : el->el_map.key; - dmap = el->el_map.type == MAP_VI ? el->el_map.vic : el->el_map.emacs; - - terminal_reset_arrow(el); - - for (i = 0; i < A_K_NKEYS; i++) { - Char wt_str[VISUAL_WIDTH_MAX]; - Char *px; - size_t n; - - p = el->el_terminal.t_str[arrow[i].key]; - if (!p || !*p) - continue; - for (n = 0; n < VISUAL_WIDTH_MAX && p[n]; ++n) - wt_str[n] = p[n]; - while (n < VISUAL_WIDTH_MAX) - wt_str[n++] = '\0'; - px = wt_str; - j = (unsigned char) *p; - /* - * Assign the arrow keys only if: - * - * 1. They are multi-character arrow keys and the user - * has not re-assigned the leading character, or - * has re-assigned the leading character to be - * ED_SEQUENCE_LEAD_IN - * 2. They are single arrow keys pointing to an - * unassigned key. - */ - if (arrow[i].type == XK_NOD) - keymacro_clear(el, map, px); - else { - if (p[1] && (dmap[j] == map[j] || - map[j] == ED_SEQUENCE_LEAD_IN)) { - keymacro_add(el, px, &arrow[i].fun, - arrow[i].type); - map[j] = ED_SEQUENCE_LEAD_IN; - } else if (map[j] == ED_UNASSIGNED) { - keymacro_clear(el, map, px); - if (arrow[i].type == XK_CMD) - map[j] = arrow[i].fun.cmd; - else - keymacro_add(el, px, &arrow[i].fun, - arrow[i].type); - } - } - } -} - -/* terminal_putc(): - * Add a character - */ -private int -terminal_putc(int c) -{ - if (terminal_outfile == NULL) - return -1; - return fputc(c, terminal_outfile); -} - -private void -terminal_tputs(EditLine *el, const char *cap, int affcnt) -{ -#ifdef _REENTRANT - pthread_mutex_lock(&terminal_mutex); -#endif - terminal_outfile = el->el_outfile; - (void)tputs(cap, affcnt, terminal_putc); -#ifdef _REENTRANT - pthread_mutex_unlock(&terminal_mutex); -#endif -} - -/* terminal__putc(): - * Add a character - */ -protected int -terminal__putc(EditLine *el, Int c) -{ - char buf[MB_LEN_MAX +1]; - ssize_t i; - mbstate_t state; - - memset(&state, 0, sizeof(mbstate_t)); - if (c == (Int)MB_FILL_CHAR) - return 0; - i = ct_encode_char(buf, (size_t)MB_CUR_MAX, c, &state); - if (i <= 0) - return (int)i; - buf[i] = '\0'; - return fputs(buf, el->el_outfile); -} - -/* terminal__flush(): - * Flush output - */ -protected void -terminal__flush(EditLine *el) -{ - - (void) fflush(el->el_outfile); -} - -/* terminal_writec(): - * Write the given character out, in a human readable form - */ -protected void -terminal_writec(EditLine *el, Int c) -{ - Char visbuf[VISUAL_WIDTH_MAX +1]; - ssize_t vcnt = ct_visual_char(visbuf, VISUAL_WIDTH_MAX, c); - visbuf[vcnt] = '\0'; - terminal_overwrite(el, visbuf, (size_t)vcnt); - terminal__flush(el); -} - - -/* terminal_telltc(): - * Print the current termcap characteristics - */ -protected int -/*ARGSUSED*/ -terminal_telltc(EditLine *el, int argc __attribute__((__unused__)), - const Char **argv __attribute__((__unused__))) -{ - const struct termcapstr *t; - char **ts; - - (void) fprintf(el->el_outfile, "\n\tYour terminal has the\n"); - (void) fprintf(el->el_outfile, "\tfollowing characteristics:\n\n"); - (void) fprintf(el->el_outfile, "\tIt has %d columns and %d lines\n", - Val(T_co), Val(T_li)); - (void) fprintf(el->el_outfile, - "\tIt has %s meta key\n", EL_HAS_META ? "a" : "no"); - (void) fprintf(el->el_outfile, - "\tIt can%suse tabs\n", EL_CAN_TAB ? " " : "not "); - (void) fprintf(el->el_outfile, "\tIt %s automatic margins\n", - EL_HAS_AUTO_MARGINS ? "has" : "does not have"); - if (EL_HAS_AUTO_MARGINS) - (void) fprintf(el->el_outfile, "\tIt %s magic margins\n", - EL_HAS_MAGIC_MARGINS ? "has" : "does not have"); - - for (t = tstr, ts = el->el_terminal.t_str; t->name != NULL; t++, ts++) { - const char *ub; - if (*ts && **ts) { - ub = ct_encode_string(ct_visual_string( - ct_decode_string(*ts, &el->el_scratch)), - &el->el_scratch); - } else { - ub = "(empty)"; - } - (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n", - t->long_name, t->name, ub); - } - (void) fputc('\n', el->el_outfile); - return 0; -} - - -/* terminal_settc(): - * Change the current terminal characteristics - */ -protected int -/*ARGSUSED*/ -terminal_settc(EditLine *el, int argc __attribute__((__unused__)), - const Char **argv) -{ - const struct termcapstr *ts; - const struct termcapval *tv; - char what[8], how[8]; - - if (argv == NULL || argv[1] == NULL || argv[2] == NULL) - return -1; - - strncpy(what, ct_encode_string(argv[1], &el->el_scratch), sizeof(what)); - what[sizeof(what) - 1] = '\0'; - strncpy(how, ct_encode_string(argv[2], &el->el_scratch), sizeof(how)); - how[sizeof(how) - 1] = '\0'; - - /* - * Do the strings first - */ - for (ts = tstr; ts->name != NULL; ts++) - if (strcmp(ts->name, what) == 0) - break; - - if (ts->name != NULL) { - terminal_alloc(el, ts, how); - terminal_setflags(el); - return 0; - } - /* - * Do the numeric ones second - */ - for (tv = tval; tv->name != NULL; tv++) - if (strcmp(tv->name, what) == 0) - break; - - if (tv->name != NULL) - return -1; - - if (tv == &tval[T_pt] || tv == &tval[T_km] || - tv == &tval[T_am] || tv == &tval[T_xn]) { - if (strcmp(how, "yes") == 0) - el->el_terminal.t_val[tv - tval] = 1; - else if (strcmp(how, "no") == 0) - el->el_terminal.t_val[tv - tval] = 0; - else { - (void) fprintf(el->el_errfile, - "" FSTR ": Bad value `%s'.\n", argv[0], how); - return -1; - } - terminal_setflags(el); - if (terminal_change_size(el, Val(T_li), Val(T_co)) == -1) - return -1; - return 0; - } else { - long i; - char *ep; - - i = strtol(how, &ep, 10); - if (*ep != '\0') { - (void) fprintf(el->el_errfile, - "" FSTR ": Bad value `%s'.\n", argv[0], how); - return -1; - } - el->el_terminal.t_val[tv - tval] = (int) i; - el->el_terminal.t_size.v = Val(T_co); - el->el_terminal.t_size.h = Val(T_li); - if (tv == &tval[T_co] || tv == &tval[T_li]) - if (terminal_change_size(el, Val(T_li), Val(T_co)) - == -1) - return -1; - return 0; - } -} - - -/* terminal_gettc(): - * Get the current terminal characteristics - */ -protected int -/*ARGSUSED*/ -terminal_gettc(EditLine *el, int argc __attribute__((__unused__)), char **argv) -{ - const struct termcapstr *ts; - const struct termcapval *tv; - char *what; - void *how; - - if (argv == NULL || argv[1] == NULL || argv[2] == NULL) - return -1; - - what = argv[1]; - how = argv[2]; - - /* - * Do the strings first - */ - for (ts = tstr; ts->name != NULL; ts++) - if (strcmp(ts->name, what) == 0) - break; - - if (ts->name != NULL) { - *(char **)how = el->el_terminal.t_str[ts - tstr]; - return 0; - } - /* - * Do the numeric ones second - */ - for (tv = tval; tv->name != NULL; tv++) - if (strcmp(tv->name, what) == 0) - break; - - if (tv->name == NULL) - return -1; - - if (tv == &tval[T_pt] || tv == &tval[T_km] || - tv == &tval[T_am] || tv == &tval[T_xn]) { - static char yes[] = "yes"; - static char no[] = "no"; - if (el->el_terminal.t_val[tv - tval]) - *(char **)how = yes; - else - *(char **)how = no; - return 0; - } else { - *(int *)how = el->el_terminal.t_val[tv - tval]; - return 0; - } -} - -/* terminal_echotc(): - * Print the termcap string out with variable substitution - */ -protected int -/*ARGSUSED*/ -terminal_echotc(EditLine *el, int argc __attribute__((__unused__)), - const Char **argv) -{ - char *cap, *scap; - Char *ep; - int arg_need, arg_cols, arg_rows; - int verbose = 0, silent = 0; - char *area; - static const char fmts[] = "%s\n", fmtd[] = "%d\n"; - const struct termcapstr *t; - char buf[TC_BUFSIZE]; - long i; - - area = buf; - - if (argv == NULL || argv[1] == NULL) - return -1; - argv++; - - if (argv[0][0] == '-') { - switch (argv[0][1]) { - case 'v': - verbose = 1; - break; - case 's': - silent = 1; - break; - default: - /* stderror(ERR_NAME | ERR_TCUSAGE); */ - break; - } - argv++; - } - if (!*argv || *argv[0] == '\0') - return 0; - if (Strcmp(*argv, STR("tabs")) == 0) { - (void) fprintf(el->el_outfile, fmts, EL_CAN_TAB ? "yes" : "no"); - return 0; - } else if (Strcmp(*argv, STR("meta")) == 0) { - (void) fprintf(el->el_outfile, fmts, Val(T_km) ? "yes" : "no"); - return 0; - } else if (Strcmp(*argv, STR("xn")) == 0) { - (void) fprintf(el->el_outfile, fmts, EL_HAS_MAGIC_MARGINS ? - "yes" : "no"); - return 0; - } else if (Strcmp(*argv, STR("am")) == 0) { - (void) fprintf(el->el_outfile, fmts, EL_HAS_AUTO_MARGINS ? - "yes" : "no"); - return 0; - } else if (Strcmp(*argv, STR("baud")) == 0) { - (void) fprintf(el->el_outfile, fmtd, (int)el->el_tty.t_speed); - return 0; - } else if (Strcmp(*argv, STR("rows")) == 0 || - Strcmp(*argv, STR("lines")) == 0) { - (void) fprintf(el->el_outfile, fmtd, Val(T_li)); - return 0; - } else if (Strcmp(*argv, STR("cols")) == 0) { - (void) fprintf(el->el_outfile, fmtd, Val(T_co)); - return 0; - } - /* - * Try to use our local definition first - */ - scap = NULL; - for (t = tstr; t->name != NULL; t++) - if (strcmp(t->name, - ct_encode_string(*argv, &el->el_scratch)) == 0) { - scap = el->el_terminal.t_str[t - tstr]; - break; - } - if (t->name == NULL) { - /* XXX: some systems' tgetstr needs non const */ - scap = tgetstr(ct_encode_string(*argv, &el->el_scratch), &area); - } - if (!scap || scap[0] == '\0') { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Termcap parameter `" FSTR "' not found.\n", - *argv); - return -1; - } - /* - * Count home many values we need for this capability. - */ - for (cap = scap, arg_need = 0; *cap; cap++) - if (*cap == '%') - switch (*++cap) { - case 'd': - case '2': - case '3': - case '.': - case '+': - arg_need++; - break; - case '%': - case '>': - case 'i': - case 'r': - case 'n': - case 'B': - case 'D': - break; - default: - /* - * hpux has lot's of them... - */ - if (verbose) - (void) fprintf(el->el_errfile, - "echotc: Warning: unknown termcap %% `%c'.\n", - *cap); - /* This is bad, but I won't complain */ - break; - } - - switch (arg_need) { - case 0: - argv++; - if (*argv && *argv[0]) { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Warning: Extra argument `" FSTR "'.\n", - *argv); - return -1; - } - terminal_tputs(el, scap, 1); - break; - case 1: - argv++; - if (!*argv || *argv[0] == '\0') { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Warning: Missing argument.\n"); - return -1; - } - arg_cols = 0; - i = Strtol(*argv, &ep, 10); - if (*ep != '\0' || i < 0) { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Bad value `" FSTR "' for rows.\n", - *argv); - return -1; - } - arg_rows = (int) i; - argv++; - if (*argv && *argv[0]) { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Warning: Extra argument `" FSTR - "'.\n", *argv); - return -1; - } - terminal_tputs(el, tgoto(scap, arg_cols, arg_rows), 1); - break; - default: - /* This is wrong, but I will ignore it... */ - if (verbose) - (void) fprintf(el->el_errfile, - "echotc: Warning: Too many required arguments (%d).\n", - arg_need); - /* FALLTHROUGH */ - case 2: - argv++; - if (!*argv || *argv[0] == '\0') { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Warning: Missing argument.\n"); - return -1; - } - i = Strtol(*argv, &ep, 10); - if (*ep != '\0' || i < 0) { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Bad value `" FSTR "' for cols.\n", - *argv); - return -1; - } - arg_cols = (int) i; - argv++; - if (!*argv || *argv[0] == '\0') { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Warning: Missing argument.\n"); - return -1; - } - i = Strtol(*argv, &ep, 10); - if (*ep != '\0' || i < 0) { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Bad value `" FSTR "' for rows.\n", - *argv); - return -1; - } - arg_rows = (int) i; - if (*ep != '\0') { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Bad value `" FSTR "'.\n", *argv); - return -1; - } - argv++; - if (*argv && *argv[0]) { - if (!silent) - (void) fprintf(el->el_errfile, - "echotc: Warning: Extra argument `" FSTR - "'.\n", *argv); - return -1; - } - terminal_tputs(el, tgoto(scap, arg_cols, arg_rows), arg_rows); - break; - } - return 0; -} diff --git a/cmd-line-utils/libedit/tokenizer.c b/cmd-line-utils/libedit/tokenizer.c deleted file mode 100644 index 7267164e9b6..00000000000 --- a/cmd-line-utils/libedit/tokenizer.c +++ /dev/null @@ -1,449 +0,0 @@ -/* $NetBSD: tokenizer.c,v 1.19 2011/07/28 20:50:55 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* We build this file twice, once as NARROW, once as WIDE. */ -/* - * tokenize.c: Bourne shell like tokenizer - */ -#include -#include -#include "histedit.h" -#include "chartype.h" - -typedef enum { - Q_none, Q_single, Q_double, Q_one, Q_doubleone -} quote_t; - -#define TOK_KEEP 1 -#define TOK_EAT 2 - -#define WINCR 20 -#define AINCR 10 - -#define IFS STR("\t \n") - -#define tok_malloc(a) malloc(a) -#define tok_free(a) free(a) -#define tok_realloc(a, b) realloc(a, b) -#define tok_strdup(a) Strdup(a) - - -struct TYPE(tokenizer) { - Char *ifs; /* In field separator */ - int argc, amax; /* Current and maximum number of args */ - 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 */ - quote_t quote; /* Quoting state */ - int flags; /* flags; */ -}; - - -private void FUN(tok,finish)(TYPE(Tokenizer) *); - - -/* FUN(tok,finish)(): - * Finish a word in the tokenizer. - */ -private void -FUN(tok,finish)(TYPE(Tokenizer) *tok) -{ - - *tok->wptr = '\0'; - if ((tok->flags & TOK_KEEP) || tok->wptr != tok->wstart) { - tok->argv[tok->argc++] = tok->wstart; - tok->argv[tok->argc] = NULL; - tok->wstart = ++tok->wptr; - } - tok->flags &= ~TOK_KEEP; -} - - -/* FUN(tok,init)(): - * Initialize the tokenizer - */ -public TYPE(Tokenizer) * -FUN(tok,init)(const Char *ifs) -{ - TYPE(Tokenizer) *tok = tok_malloc(sizeof(*tok)); - - if (tok == NULL) - return NULL; - tok->ifs = tok_strdup(ifs ? ifs : IFS); - if (tok->ifs == NULL) { - tok_free(tok); - return NULL; - } - tok->argc = 0; - tok->amax = AINCR; - tok->argv = tok_malloc(sizeof(*tok->argv) * tok->amax); - if (tok->argv == NULL) { - tok_free(tok->ifs); - tok_free(tok); - return NULL; - } - tok->argv[0] = NULL; - tok->wspace = tok_malloc(WINCR * sizeof(*tok->wspace)); - if (tok->wspace == NULL) { - tok_free(tok->argv); - tok_free(tok->ifs); - tok_free(tok); - return NULL; - } - tok->wmax = tok->wspace + WINCR; - tok->wstart = tok->wspace; - tok->wptr = tok->wspace; - tok->flags = 0; - tok->quote = Q_none; - - return (tok); -} - - -/* FUN(tok,reset)(): - * Reset the tokenizer - */ -public void -FUN(tok,reset)(TYPE(Tokenizer) *tok) -{ - - tok->argc = 0; - tok->wstart = tok->wspace; - tok->wptr = tok->wspace; - tok->flags = 0; - tok->quote = Q_none; -} - - -/* FUN(tok,end)(): - * Clean up - */ -public void -FUN(tok,end)(TYPE(Tokenizer) *tok) -{ - - tok_free(tok->ifs); - tok_free(tok->wspace); - tok_free(tok->argv); - tok_free(tok); -} - - - -/* FUN(tok,line)(): - * Bourne shell (sh(1)) like tokenizing - * Arguments: - * tok current tokenizer state (setup with FUN(tok,init)()) - * line line to parse - * Returns: - * -1 Internal error - * 3 Quoted return - * 2 Unmatched double quote - * 1 Unmatched single quote - * 0 Ok - * Modifies (if return value is 0): - * argc number of arguments - * argv argument array - * cursorc if !NULL, argv element containing cursor - * cursorv if !NULL, offset in argv[cursorc] of cursor - */ -public int -FUN(tok,line)(TYPE(Tokenizer) *tok, const TYPE(LineInfo) *line, - int *argc, const Char ***argv, int *cursorc, int *cursoro) -{ - const Char *ptr; - int cc, co; - - cc = co = -1; - ptr = line->buffer; - for (ptr = line->buffer; ;ptr++) { - if (ptr >= line->lastchar) - ptr = STR(""); - if (ptr == line->cursor) { - cc = tok->argc; - co = (int)(tok->wptr - tok->wstart); - } - switch (*ptr) { - case '\'': - tok->flags |= TOK_KEEP; - tok->flags &= ~TOK_EAT; - switch (tok->quote) { - case Q_none: - tok->quote = Q_single; /* Enter single quote - * mode */ - break; - - case Q_single: /* Exit single quote mode */ - tok->quote = Q_none; - break; - - case Q_one: /* Quote this ' */ - tok->quote = Q_none; - *tok->wptr++ = *ptr; - break; - - case Q_double: /* Stay in double quote mode */ - *tok->wptr++ = *ptr; - break; - - case Q_doubleone: /* Quote this ' */ - tok->quote = Q_double; - *tok->wptr++ = *ptr; - break; - - default: - return (-1); - } - break; - - case '"': - tok->flags &= ~TOK_EAT; - tok->flags |= TOK_KEEP; - switch (tok->quote) { - case Q_none: /* Enter double quote mode */ - tok->quote = Q_double; - break; - - case Q_double: /* Exit double quote mode */ - tok->quote = Q_none; - break; - - case Q_one: /* Quote this " */ - tok->quote = Q_none; - *tok->wptr++ = *ptr; - break; - - case Q_single: /* Stay in single quote mode */ - *tok->wptr++ = *ptr; - break; - - case Q_doubleone: /* Quote this " */ - tok->quote = Q_double; - *tok->wptr++ = *ptr; - break; - - default: - return (-1); - } - break; - - case '\\': - tok->flags |= TOK_KEEP; - tok->flags &= ~TOK_EAT; - switch (tok->quote) { - case Q_none: /* Quote next character */ - tok->quote = Q_one; - break; - - case Q_double: /* Quote next character */ - tok->quote = Q_doubleone; - break; - - case Q_one: /* Quote this, restore state */ - *tok->wptr++ = *ptr; - tok->quote = Q_none; - break; - - case Q_single: /* Stay in single quote mode */ - *tok->wptr++ = *ptr; - break; - - case Q_doubleone: /* Quote this \ */ - tok->quote = Q_double; - *tok->wptr++ = *ptr; - break; - - default: - return (-1); - } - break; - - case '\n': - tok->flags &= ~TOK_EAT; - switch (tok->quote) { - case Q_none: - goto tok_line_outok; - - case Q_single: - case Q_double: - *tok->wptr++ = *ptr; /* Add the return */ - break; - - case Q_doubleone: /* Back to double, eat the '\n' */ - tok->flags |= TOK_EAT; - tok->quote = Q_double; - break; - - case Q_one: /* No quote, more eat the '\n' */ - tok->flags |= TOK_EAT; - tok->quote = Q_none; - break; - - default: - return (0); - } - break; - - case '\0': - switch (tok->quote) { - case Q_none: - /* Finish word and return */ - if (tok->flags & TOK_EAT) { - tok->flags &= ~TOK_EAT; - return (3); - } - goto tok_line_outok; - - case Q_single: - return (1); - - case Q_double: - return (2); - - case Q_doubleone: - tok->quote = Q_double; - *tok->wptr++ = *ptr; - break; - - case Q_one: - tok->quote = Q_none; - *tok->wptr++ = *ptr; - break; - - default: - return (-1); - } - break; - - default: - tok->flags &= ~TOK_EAT; - switch (tok->quote) { - case Q_none: - if (Strchr(tok->ifs, *ptr) != NULL) - FUN(tok,finish)(tok); - else - *tok->wptr++ = *ptr; - break; - - case Q_single: - case Q_double: - *tok->wptr++ = *ptr; - break; - - - case Q_doubleone: - *tok->wptr++ = '\\'; - tok->quote = Q_double; - *tok->wptr++ = *ptr; - break; - - case Q_one: - tok->quote = Q_none; - *tok->wptr++ = *ptr; - break; - - default: - return (-1); - - } - break; - } - - if (tok->wptr >= tok->wmax - 4) { - size_t size = tok->wmax - tok->wspace + WINCR; - Char *s = tok_realloc(tok->wspace, - size * sizeof(*s)); - if (s == NULL) - return (-1); - - if (s != tok->wspace) { - int i; - 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) { - Char **p; - tok->amax += AINCR; - p = tok_realloc(tok->argv, tok->amax * sizeof(*p)); - if (p == NULL) - return (-1); - tok->argv = p; - } - } - tok_line_outok: - if (cc == -1 && co == -1) { - cc = tok->argc; - co = (int)(tok->wptr - tok->wstart); - } - if (cursorc != NULL) - *cursorc = cc; - if (cursoro != NULL) - *cursoro = co; - FUN(tok,finish)(tok); - *argv = (const Char **)tok->argv; - *argc = tok->argc; - return (0); -} - -/* FUN(tok,str)(): - * Simpler version of tok_line, taking a NUL terminated line - * and splitting into words, ignoring cursor state. - */ -public int -FUN(tok,str)(TYPE(Tokenizer) *tok, const Char *line, int *argc, - const Char ***argv) -{ - TYPE(LineInfo) li; - - memset(&li, 0, sizeof(li)); - li.buffer = line; - li.cursor = li.lastchar = Strchr(line, '\0'); - return (FUN(tok,line)(tok, &li, argc, argv, NULL, NULL)); -} diff --git a/cmd-line-utils/libedit/tokenizern.c b/cmd-line-utils/libedit/tokenizern.c deleted file mode 100644 index 92376e066f1..00000000000 --- a/cmd-line-utils/libedit/tokenizern.c +++ /dev/null @@ -1,5 +0,0 @@ -#define NARROW_WRAPPER -#include "config.h" -#undef WIDECHAR -#define NARROWCHAR -#include "./tokenizer.c" diff --git a/cmd-line-utils/libedit/tty.c b/cmd-line-utils/libedit/tty.c deleted file mode 100644 index eea00bfc245..00000000000 --- a/cmd-line-utils/libedit/tty.c +++ /dev/null @@ -1,1353 +0,0 @@ -/* $NetBSD: tty.c,v 1.41 2011/10/04 15:27:04 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * tty.c: tty interface stuff - */ -#include -#include -#include /* for isatty */ -#include /* for ffs */ -#include "el.h" -#include "tty.h" - -typedef struct ttymodes_t { - const char *m_name; - unsigned int m_value; - int m_type; -} 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; - - -private const ttyperm_t ttyperm = { - { - {"iflag:", ICRNL, (INLCR | IGNCR)}, - {"oflag:", (OPOST | ONLCR), ONLRET}, - {"cflag:", 0, 0}, - {"lflag:", (ISIG | ICANON | ECHO | ECHOE | ECHOCTL | IEXTEN), - (NOFLSH | ECHONL | EXTPROC | FLUSHO)}, - {"chars:", 0, 0}, - }, - { - {"iflag:", (INLCR | ICRNL), IGNCR}, - {"oflag:", (OPOST | ONLCR), ONLRET}, - {"cflag:", 0, 0}, - {"lflag:", ISIG, - (NOFLSH | ICANON | ECHO | ECHOK | ECHONL | EXTPROC | IEXTEN | FLUSHO)}, - {"chars:", (C_SH(C_MIN) | C_SH(C_TIME) | C_SH(C_SWTCH) | C_SH(C_DSWTCH) | - C_SH(C_SUSP) | C_SH(C_DSUSP) | C_SH(C_EOL) | C_SH(C_DISCARD) | - C_SH(C_PGOFF) | C_SH(C_PAGE) | C_SH(C_STATUS)), 0} - }, - { - {"iflag:", 0, IXON | IXOFF | INLCR | ICRNL}, - {"oflag:", 0, 0}, - {"cflag:", 0, 0}, - {"lflag:", 0, ISIG | IEXTEN}, - {"chars:", 0, 0}, - } -}; - -private const ttychar_t ttychar = { - { - CINTR, CQUIT, CERASE, CKILL, - CEOF, CEOL, CEOL2, CSWTCH, - CDSWTCH, CERASE2, CSTART, CSTOP, - CWERASE, CSUSP, CDSUSP, CREPRINT, - CDISCARD, CLNEXT, CSTATUS, CPAGE, - CPGOFF, CKILL2, CBRK, CMIN, - CTIME - }, - { - CINTR, CQUIT, CERASE, CKILL, - _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, - _POSIX_VDISABLE, CERASE2, CSTART, CSTOP, - _POSIX_VDISABLE, CSUSP, _POSIX_VDISABLE, _POSIX_VDISABLE, - CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, - _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, 1, - 0 - }, - { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0 - } -}; - -private const ttymap_t tty_map[] = { -#ifdef VERASE - {C_ERASE, VERASE, - {EM_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR}}, -#endif /* VERASE */ -#ifdef VERASE2 - {C_ERASE2, VERASE2, - {EM_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR}}, -#endif /* VERASE2 */ -#ifdef VKILL - {C_KILL, VKILL, - {EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED}}, -#endif /* VKILL */ -#ifdef VKILL2 - {C_KILL2, VKILL2, - {EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED}}, -#endif /* VKILL2 */ -#ifdef VEOF - {C_EOF, VEOF, - {EM_DELETE_OR_LIST, VI_LIST_OR_EOF, ED_UNASSIGNED}}, -#endif /* VEOF */ -#ifdef VWERASE - {C_WERASE, VWERASE, - {ED_DELETE_PREV_WORD, ED_DELETE_PREV_WORD, ED_PREV_WORD}}, -#endif /* VWERASE */ -#ifdef VREPRINT - {C_REPRINT, VREPRINT, - {ED_REDISPLAY, ED_INSERT, ED_REDISPLAY}}, -#endif /* VREPRINT */ -#ifdef VLNEXT - {C_LNEXT, VLNEXT, - {ED_QUOTED_INSERT, ED_QUOTED_INSERT, ED_UNASSIGNED}}, -#endif /* VLNEXT */ - {(Int)-1, (Int)-1, - {ED_UNASSIGNED, ED_UNASSIGNED, ED_UNASSIGNED}} -}; - -private const ttymodes_t ttymodes[] = { -#ifdef IGNBRK - {"ignbrk", IGNBRK, MD_INP}, -#endif /* IGNBRK */ -#ifdef BRKINT - {"brkint", BRKINT, MD_INP}, -#endif /* BRKINT */ -#ifdef IGNPAR - {"ignpar", IGNPAR, MD_INP}, -#endif /* IGNPAR */ -#ifdef PARMRK - {"parmrk", PARMRK, MD_INP}, -#endif /* PARMRK */ -#ifdef INPCK - {"inpck", INPCK, MD_INP}, -#endif /* INPCK */ -#ifdef ISTRIP - {"istrip", ISTRIP, MD_INP}, -#endif /* ISTRIP */ -#ifdef INLCR - {"inlcr", INLCR, MD_INP}, -#endif /* INLCR */ -#ifdef IGNCR - {"igncr", IGNCR, MD_INP}, -#endif /* IGNCR */ -#ifdef ICRNL - {"icrnl", ICRNL, MD_INP}, -#endif /* ICRNL */ -#ifdef IUCLC - {"iuclc", IUCLC, MD_INP}, -#endif /* IUCLC */ -#ifdef IXON - {"ixon", IXON, MD_INP}, -#endif /* IXON */ -#ifdef IXANY - {"ixany", IXANY, MD_INP}, -#endif /* IXANY */ -#ifdef IXOFF - {"ixoff", IXOFF, MD_INP}, -#endif /* IXOFF */ -#ifdef IMAXBEL - {"imaxbel", IMAXBEL, MD_INP}, -#endif /* IMAXBEL */ - -#ifdef OPOST - {"opost", OPOST, MD_OUT}, -#endif /* OPOST */ -#ifdef OLCUC - {"olcuc", OLCUC, MD_OUT}, -#endif /* OLCUC */ -#ifdef ONLCR - {"onlcr", ONLCR, MD_OUT}, -#endif /* ONLCR */ -#ifdef OCRNL - {"ocrnl", OCRNL, MD_OUT}, -#endif /* OCRNL */ -#ifdef ONOCR - {"onocr", ONOCR, MD_OUT}, -#endif /* ONOCR */ -#ifdef ONOEOT - {"onoeot", ONOEOT, MD_OUT}, -#endif /* ONOEOT */ -#ifdef ONLRET - {"onlret", ONLRET, MD_OUT}, -#endif /* ONLRET */ -#ifdef OFILL - {"ofill", OFILL, MD_OUT}, -#endif /* OFILL */ -#ifdef OFDEL - {"ofdel", OFDEL, MD_OUT}, -#endif /* OFDEL */ -#ifdef NLDLY - {"nldly", NLDLY, MD_OUT}, -#endif /* NLDLY */ -#ifdef CRDLY - {"crdly", CRDLY, MD_OUT}, -#endif /* CRDLY */ -#ifdef TABDLY - {"tabdly", TABDLY, MD_OUT}, -#endif /* TABDLY */ -#ifdef XTABS - {"xtabs", XTABS, MD_OUT}, -#endif /* XTABS */ -#ifdef BSDLY - {"bsdly", BSDLY, MD_OUT}, -#endif /* BSDLY */ -#ifdef VTDLY - {"vtdly", VTDLY, MD_OUT}, -#endif /* VTDLY */ -#ifdef FFDLY - {"ffdly", FFDLY, MD_OUT}, -#endif /* FFDLY */ -#ifdef PAGEOUT - {"pageout", PAGEOUT, MD_OUT}, -#endif /* PAGEOUT */ -#ifdef WRAP - {"wrap", WRAP, MD_OUT}, -#endif /* WRAP */ - -#ifdef CIGNORE - {"cignore", CIGNORE, MD_CTL}, -#endif /* CBAUD */ -#ifdef CBAUD - {"cbaud", CBAUD, MD_CTL}, -#endif /* CBAUD */ -#ifdef CSTOPB - {"cstopb", CSTOPB, MD_CTL}, -#endif /* CSTOPB */ -#ifdef CREAD - {"cread", CREAD, MD_CTL}, -#endif /* CREAD */ -#ifdef PARENB - {"parenb", PARENB, MD_CTL}, -#endif /* PARENB */ -#ifdef PARODD - {"parodd", PARODD, MD_CTL}, -#endif /* PARODD */ -#ifdef HUPCL - {"hupcl", HUPCL, MD_CTL}, -#endif /* HUPCL */ -#ifdef CLOCAL - {"clocal", CLOCAL, MD_CTL}, -#endif /* CLOCAL */ -#ifdef LOBLK - {"loblk", LOBLK, MD_CTL}, -#endif /* LOBLK */ -#ifdef CIBAUD - {"cibaud", CIBAUD, MD_CTL}, -#endif /* CIBAUD */ -#ifdef CRTSCTS -#ifdef CCTS_OFLOW - {"ccts_oflow", CCTS_OFLOW, MD_CTL}, -#else - {"crtscts", CRTSCTS, MD_CTL}, -#endif /* CCTS_OFLOW */ -#endif /* CRTSCTS */ -#ifdef CRTS_IFLOW - {"crts_iflow", CRTS_IFLOW, MD_CTL}, -#endif /* CRTS_IFLOW */ -#ifdef CDTRCTS - {"cdtrcts", CDTRCTS, MD_CTL}, -#endif /* CDTRCTS */ -#ifdef MDMBUF - {"mdmbuf", MDMBUF, MD_CTL}, -#endif /* MDMBUF */ -#ifdef RCV1EN - {"rcv1en", RCV1EN, MD_CTL}, -#endif /* RCV1EN */ -#ifdef XMT1EN - {"xmt1en", XMT1EN, MD_CTL}, -#endif /* XMT1EN */ - -#ifdef ISIG - {"isig", ISIG, MD_LIN}, -#endif /* ISIG */ -#ifdef ICANON - {"icanon", ICANON, MD_LIN}, -#endif /* ICANON */ -#ifdef XCASE - {"xcase", XCASE, MD_LIN}, -#endif /* XCASE */ -#ifdef ECHO - {"echo", ECHO, MD_LIN}, -#endif /* ECHO */ -#ifdef ECHOE - {"echoe", ECHOE, MD_LIN}, -#endif /* ECHOE */ -#ifdef ECHOK - {"echok", ECHOK, MD_LIN}, -#endif /* ECHOK */ -#ifdef ECHONL - {"echonl", ECHONL, MD_LIN}, -#endif /* ECHONL */ -#ifdef NOFLSH - {"noflsh", NOFLSH, MD_LIN}, -#endif /* NOFLSH */ -#ifdef TOSTOP - {"tostop", TOSTOP, MD_LIN}, -#endif /* TOSTOP */ -#ifdef ECHOCTL - {"echoctl", ECHOCTL, MD_LIN}, -#endif /* ECHOCTL */ -#ifdef ECHOPRT - {"echoprt", ECHOPRT, MD_LIN}, -#endif /* ECHOPRT */ -#ifdef ECHOKE - {"echoke", ECHOKE, MD_LIN}, -#endif /* ECHOKE */ -#ifdef DEFECHO - {"defecho", DEFECHO, MD_LIN}, -#endif /* DEFECHO */ -#ifdef FLUSHO - {"flusho", FLUSHO, MD_LIN}, -#endif /* FLUSHO */ -#ifdef PENDIN - {"pendin", PENDIN, MD_LIN}, -#endif /* PENDIN */ -#ifdef IEXTEN - {"iexten", IEXTEN, MD_LIN}, -#endif /* IEXTEN */ -#ifdef NOKERNINFO - {"nokerninfo", NOKERNINFO, MD_LIN}, -#endif /* NOKERNINFO */ -#ifdef ALTWERASE - {"altwerase", ALTWERASE, MD_LIN}, -#endif /* ALTWERASE */ -#ifdef EXTPROC - {"extproc", EXTPROC, MD_LIN}, -#endif /* EXTPROC */ - -#if defined(VINTR) - {"intr", C_SH(C_INTR), MD_CHAR}, -#endif /* VINTR */ -#if defined(VQUIT) - {"quit", C_SH(C_QUIT), MD_CHAR}, -#endif /* VQUIT */ -#if defined(VERASE) - {"erase", C_SH(C_ERASE), MD_CHAR}, -#endif /* VERASE */ -#if defined(VKILL) - {"kill", C_SH(C_KILL), MD_CHAR}, -#endif /* VKILL */ -#if defined(VEOF) - {"eof", C_SH(C_EOF), MD_CHAR}, -#endif /* VEOF */ -#if defined(VEOL) - {"eol", C_SH(C_EOL), MD_CHAR}, -#endif /* VEOL */ -#if defined(VEOL2) - {"eol2", C_SH(C_EOL2), MD_CHAR}, -#endif /* VEOL2 */ -#if defined(VSWTCH) - {"swtch", C_SH(C_SWTCH), MD_CHAR}, -#endif /* VSWTCH */ -#if defined(VDSWTCH) - {"dswtch", C_SH(C_DSWTCH), MD_CHAR}, -#endif /* VDSWTCH */ -#if defined(VERASE2) - {"erase2", C_SH(C_ERASE2), MD_CHAR}, -#endif /* VERASE2 */ -#if defined(VSTART) - {"start", C_SH(C_START), MD_CHAR}, -#endif /* VSTART */ -#if defined(VSTOP) - {"stop", C_SH(C_STOP), MD_CHAR}, -#endif /* VSTOP */ -#if defined(VWERASE) - {"werase", C_SH(C_WERASE), MD_CHAR}, -#endif /* VWERASE */ -#if defined(VSUSP) - {"susp", C_SH(C_SUSP), MD_CHAR}, -#endif /* VSUSP */ -#if defined(VDSUSP) - {"dsusp", C_SH(C_DSUSP), MD_CHAR}, -#endif /* VDSUSP */ -#if defined(VREPRINT) - {"reprint", C_SH(C_REPRINT), MD_CHAR}, -#endif /* VREPRINT */ -#if defined(VDISCARD) - {"discard", C_SH(C_DISCARD), MD_CHAR}, -#endif /* VDISCARD */ -#if defined(VLNEXT) - {"lnext", C_SH(C_LNEXT), MD_CHAR}, -#endif /* VLNEXT */ -#if defined(VSTATUS) - {"status", C_SH(C_STATUS), MD_CHAR}, -#endif /* VSTATUS */ -#if defined(VPAGE) - {"page", C_SH(C_PAGE), MD_CHAR}, -#endif /* VPAGE */ -#if defined(VPGOFF) - {"pgoff", C_SH(C_PGOFF), MD_CHAR}, -#endif /* VPGOFF */ -#if defined(VKILL2) - {"kill2", C_SH(C_KILL2), MD_CHAR}, -#endif /* VKILL2 */ -#if defined(VBRK) - {"brk", C_SH(C_BRK), MD_CHAR}, -#endif /* VBRK */ -#if defined(VMIN) - {"min", C_SH(C_MIN), MD_CHAR}, -#endif /* VMIN */ -#if defined(VTIME) - {"time", C_SH(C_TIME), MD_CHAR}, -#endif /* VTIME */ - {NULL, 0, -1}, -}; - - - -#define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1) -#define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8) -#define tty__cooked_mode(td) ((td)->c_lflag & ICANON) - -private int tty_getty(EditLine *, struct termios *); -private int tty_setty(EditLine *, int, const struct termios *); -private int tty__getcharindex(int); -private void tty__getchar(struct termios *, unsigned char *); -private void tty__setchar(struct termios *, unsigned char *); -private speed_t tty__getspeed(struct termios *); -private int tty_setup(EditLine *); - -#define t_qu t_ts - -/* tty_getty(): - * Wrapper for tcgetattr to handle EINTR - */ -private int -tty_getty(EditLine *el, struct termios *t) -{ - int rv; - while ((rv = tcgetattr(el->el_infd, t)) == -1 && errno == EINTR) - continue; - return rv; -} - -/* tty_setty(): - * Wrapper for tcsetattr to handle EINTR - */ -private int -tty_setty(EditLine *el, int action, const struct termios *t) -{ - int rv; - while ((rv = tcsetattr(el->el_infd, action, t)) == -1 && errno == EINTR) - continue; - return rv; -} - -/* tty_setup(): - * Get the tty parameters and initialize the editing state - */ -private int -tty_setup(EditLine *el) -{ - int rst = 1; - - if (el->el_flags & EDIT_DISABLED) - return 0; - - if (!isatty(el->el_outfd)) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, - "tty_setup: isatty: %s\n", strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - if (tty_getty(el, &el->el_tty.t_ed) == -1) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, - "tty_setup: tty_getty: %s\n", strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - el->el_tty.t_ts = el->el_tty.t_ex = el->el_tty.t_ed; - - el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ex); - el->el_tty.t_tabs = tty__gettabs(&el->el_tty.t_ex); - el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ex); - - el->el_tty.t_ex.c_iflag &= ~el->el_tty.t_t[EX_IO][MD_INP].t_clrmask; - el->el_tty.t_ex.c_iflag |= el->el_tty.t_t[EX_IO][MD_INP].t_setmask; - - el->el_tty.t_ex.c_oflag &= ~el->el_tty.t_t[EX_IO][MD_OUT].t_clrmask; - el->el_tty.t_ex.c_oflag |= el->el_tty.t_t[EX_IO][MD_OUT].t_setmask; - - el->el_tty.t_ex.c_cflag &= ~el->el_tty.t_t[EX_IO][MD_CTL].t_clrmask; - el->el_tty.t_ex.c_cflag |= el->el_tty.t_t[EX_IO][MD_CTL].t_setmask; - - el->el_tty.t_ex.c_lflag &= ~el->el_tty.t_t[EX_IO][MD_LIN].t_clrmask; - el->el_tty.t_ex.c_lflag |= el->el_tty.t_t[EX_IO][MD_LIN].t_setmask; - - /* - * Reset the tty chars to reasonable defaults - * If they are disabled, then enable them. - */ - if (rst) { - if (tty__cooked_mode(&el->el_tty.t_ts)) { - tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[TS_IO]); - /* - * Don't affect CMIN and CTIME for the editor mode - */ - for (rst = 0; rst < C_NCC - 2; rst++) - if (el->el_tty.t_c[TS_IO][rst] != - el->el_tty.t_vdisable - && el->el_tty.t_c[ED_IO][rst] != - el->el_tty.t_vdisable) - el->el_tty.t_c[ED_IO][rst] = - el->el_tty.t_c[TS_IO][rst]; - for (rst = 0; rst < C_NCC; rst++) - if (el->el_tty.t_c[TS_IO][rst] != - el->el_tty.t_vdisable) - el->el_tty.t_c[EX_IO][rst] = - el->el_tty.t_c[TS_IO][rst]; - } - tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]); - if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ex) == -1) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, - "tty_setup: tty_setty: %s\n", - strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - } - - el->el_tty.t_ed.c_iflag &= ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask; - el->el_tty.t_ed.c_iflag |= el->el_tty.t_t[ED_IO][MD_INP].t_setmask; - - el->el_tty.t_ed.c_oflag &= ~el->el_tty.t_t[ED_IO][MD_OUT].t_clrmask; - el->el_tty.t_ed.c_oflag |= el->el_tty.t_t[ED_IO][MD_OUT].t_setmask; - - el->el_tty.t_ed.c_cflag &= ~el->el_tty.t_t[ED_IO][MD_CTL].t_clrmask; - el->el_tty.t_ed.c_cflag |= el->el_tty.t_t[ED_IO][MD_CTL].t_setmask; - - el->el_tty.t_ed.c_lflag &= ~el->el_tty.t_t[ED_IO][MD_LIN].t_clrmask; - el->el_tty.t_ed.c_lflag |= el->el_tty.t_t[ED_IO][MD_LIN].t_setmask; - - tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[ED_IO]); - tty_bind_char(el, 1); - return 0; -} - -protected int -tty_init(EditLine *el) -{ - - el->el_tty.t_mode = EX_IO; - el->el_tty.t_vdisable = _POSIX_VDISABLE; - (void) memcpy(el->el_tty.t_t, ttyperm, sizeof(ttyperm_t)); - (void) memcpy(el->el_tty.t_c, ttychar, sizeof(ttychar_t)); - return tty_setup(el); -} - - -/* tty_end(): - * Restore the tty to its original settings - */ -protected void -/*ARGSUSED*/ -tty_end(EditLine *el __attribute__((__unused__))) -{ - - /* XXX: Maybe reset to an initial state? */ -} - - -/* tty__getspeed(): - * Get the tty speed - */ -private speed_t -tty__getspeed(struct termios *td) -{ - speed_t spd; - - if ((spd = cfgetispeed(td)) == 0) - spd = cfgetospeed(td); - return spd; -} - -/* tty__getspeed(): - * Return the index of the asked char in the c_cc array - */ -private int -tty__getcharindex(int i) -{ - switch (i) { -#ifdef VINTR - case C_INTR: - return VINTR; -#endif /* VINTR */ -#ifdef VQUIT - case C_QUIT: - return VQUIT; -#endif /* VQUIT */ -#ifdef VERASE - case C_ERASE: - return VERASE; -#endif /* VERASE */ -#ifdef VKILL - case C_KILL: - return VKILL; -#endif /* VKILL */ -#ifdef VEOF - case C_EOF: - return VEOF; -#endif /* VEOF */ -#ifdef VEOL - case C_EOL: - return VEOL; -#endif /* VEOL */ -#ifdef VEOL2 - case C_EOL2: - return VEOL2; -#endif /* VEOL2 */ -#ifdef VSWTCH - case C_SWTCH: - return VSWTCH; -#endif /* VSWTCH */ -#ifdef VDSWTCH - case C_DSWTCH: - return VDSWTCH; -#endif /* VDSWTCH */ -#ifdef VERASE2 - case C_ERASE2: - return VERASE2; -#endif /* VERASE2 */ -#ifdef VSTART - case C_START: - return VSTART; -#endif /* VSTART */ -#ifdef VSTOP - case C_STOP: - return VSTOP; -#endif /* VSTOP */ -#ifdef VWERASE - case C_WERASE: - return VWERASE; -#endif /* VWERASE */ -#ifdef VSUSP - case C_SUSP: - return VSUSP; -#endif /* VSUSP */ -#ifdef VDSUSP - case C_DSUSP: - return VDSUSP; -#endif /* VDSUSP */ -#ifdef VREPRINT - case C_REPRINT: - return VREPRINT; -#endif /* VREPRINT */ -#ifdef VDISCARD - case C_DISCARD: - return VDISCARD; -#endif /* VDISCARD */ -#ifdef VLNEXT - case C_LNEXT: - return VLNEXT; -#endif /* VLNEXT */ -#ifdef VSTATUS - case C_STATUS: - return VSTATUS; -#endif /* VSTATUS */ -#ifdef VPAGE - case C_PAGE: - return VPAGE; -#endif /* VPAGE */ -#ifdef VPGOFF - case C_PGOFF: - return VPGOFF; -#endif /* VPGOFF */ -#ifdef VKILL2 - case C_KILL2: - return VKILL2; -#endif /* KILL2 */ -#ifdef VMIN - case C_MIN: - return VMIN; -#endif /* VMIN */ -#ifdef VTIME - case C_TIME: - return VTIME; -#endif /* VTIME */ - default: - return -1; - } -} - -/* tty__getchar(): - * Get the tty characters - */ -private void -tty__getchar(struct termios *td, unsigned char *s) -{ - -#ifdef VINTR - s[C_INTR] = td->c_cc[VINTR]; -#endif /* VINTR */ -#ifdef VQUIT - s[C_QUIT] = td->c_cc[VQUIT]; -#endif /* VQUIT */ -#ifdef VERASE - s[C_ERASE] = td->c_cc[VERASE]; -#endif /* VERASE */ -#ifdef VKILL - s[C_KILL] = td->c_cc[VKILL]; -#endif /* VKILL */ -#ifdef VEOF - s[C_EOF] = td->c_cc[VEOF]; -#endif /* VEOF */ -#ifdef VEOL - s[C_EOL] = td->c_cc[VEOL]; -#endif /* VEOL */ -#ifdef VEOL2 - s[C_EOL2] = td->c_cc[VEOL2]; -#endif /* VEOL2 */ -#ifdef VSWTCH - s[C_SWTCH] = td->c_cc[VSWTCH]; -#endif /* VSWTCH */ -#ifdef VDSWTCH - s[C_DSWTCH] = td->c_cc[VDSWTCH]; -#endif /* VDSWTCH */ -#ifdef VERASE2 - s[C_ERASE2] = td->c_cc[VERASE2]; -#endif /* VERASE2 */ -#ifdef VSTART - s[C_START] = td->c_cc[VSTART]; -#endif /* VSTART */ -#ifdef VSTOP - s[C_STOP] = td->c_cc[VSTOP]; -#endif /* VSTOP */ -#ifdef VWERASE - s[C_WERASE] = td->c_cc[VWERASE]; -#endif /* VWERASE */ -#ifdef VSUSP - s[C_SUSP] = td->c_cc[VSUSP]; -#endif /* VSUSP */ -#ifdef VDSUSP - s[C_DSUSP] = td->c_cc[VDSUSP]; -#endif /* VDSUSP */ -#ifdef VREPRINT - s[C_REPRINT] = td->c_cc[VREPRINT]; -#endif /* VREPRINT */ -#ifdef VDISCARD - s[C_DISCARD] = td->c_cc[VDISCARD]; -#endif /* VDISCARD */ -#ifdef VLNEXT - s[C_LNEXT] = td->c_cc[VLNEXT]; -#endif /* VLNEXT */ -#ifdef VSTATUS - s[C_STATUS] = td->c_cc[VSTATUS]; -#endif /* VSTATUS */ -#ifdef VPAGE - s[C_PAGE] = td->c_cc[VPAGE]; -#endif /* VPAGE */ -#ifdef VPGOFF - s[C_PGOFF] = td->c_cc[VPGOFF]; -#endif /* VPGOFF */ -#ifdef VKILL2 - s[C_KILL2] = td->c_cc[VKILL2]; -#endif /* KILL2 */ -#ifdef VMIN - s[C_MIN] = td->c_cc[VMIN]; -#endif /* VMIN */ -#ifdef VTIME - s[C_TIME] = td->c_cc[VTIME]; -#endif /* VTIME */ -} /* tty__getchar */ - - -/* tty__setchar(): - * Set the tty characters - */ -private void -tty__setchar(struct termios *td, unsigned char *s) -{ - -#ifdef VINTR - td->c_cc[VINTR] = s[C_INTR]; -#endif /* VINTR */ -#ifdef VQUIT - td->c_cc[VQUIT] = s[C_QUIT]; -#endif /* VQUIT */ -#ifdef VERASE - td->c_cc[VERASE] = s[C_ERASE]; -#endif /* VERASE */ -#ifdef VKILL - td->c_cc[VKILL] = s[C_KILL]; -#endif /* VKILL */ -#ifdef VEOF - td->c_cc[VEOF] = s[C_EOF]; -#endif /* VEOF */ -#ifdef VEOL - td->c_cc[VEOL] = s[C_EOL]; -#endif /* VEOL */ -#ifdef VEOL2 - td->c_cc[VEOL2] = s[C_EOL2]; -#endif /* VEOL2 */ -#ifdef VSWTCH - td->c_cc[VSWTCH] = s[C_SWTCH]; -#endif /* VSWTCH */ -#ifdef VDSWTCH - td->c_cc[VDSWTCH] = s[C_DSWTCH]; -#endif /* VDSWTCH */ -#ifdef VERASE2 - td->c_cc[VERASE2] = s[C_ERASE2]; -#endif /* VERASE2 */ -#ifdef VSTART - td->c_cc[VSTART] = s[C_START]; -#endif /* VSTART */ -#ifdef VSTOP - td->c_cc[VSTOP] = s[C_STOP]; -#endif /* VSTOP */ -#ifdef VWERASE - td->c_cc[VWERASE] = s[C_WERASE]; -#endif /* VWERASE */ -#ifdef VSUSP - td->c_cc[VSUSP] = s[C_SUSP]; -#endif /* VSUSP */ -#ifdef VDSUSP - td->c_cc[VDSUSP] = s[C_DSUSP]; -#endif /* VDSUSP */ -#ifdef VREPRINT - td->c_cc[VREPRINT] = s[C_REPRINT]; -#endif /* VREPRINT */ -#ifdef VDISCARD - td->c_cc[VDISCARD] = s[C_DISCARD]; -#endif /* VDISCARD */ -#ifdef VLNEXT - td->c_cc[VLNEXT] = s[C_LNEXT]; -#endif /* VLNEXT */ -#ifdef VSTATUS - td->c_cc[VSTATUS] = s[C_STATUS]; -#endif /* VSTATUS */ -#ifdef VPAGE - td->c_cc[VPAGE] = s[C_PAGE]; -#endif /* VPAGE */ -#ifdef VPGOFF - td->c_cc[VPGOFF] = s[C_PGOFF]; -#endif /* VPGOFF */ -#ifdef VKILL2 - td->c_cc[VKILL2] = s[C_KILL2]; -#endif /* VKILL2 */ -#ifdef VMIN - td->c_cc[VMIN] = s[C_MIN]; -#endif /* VMIN */ -#ifdef VTIME - td->c_cc[VTIME] = s[C_TIME]; -#endif /* VTIME */ -} /* tty__setchar */ - - -/* tty_bind_char(): - * Rebind the editline functions - */ -protected void -tty_bind_char(EditLine *el, int force) -{ - - unsigned char *t_n = el->el_tty.t_c[ED_IO]; - unsigned char *t_o = el->el_tty.t_ed.c_cc; - Char new[2], old[2]; - const ttymap_t *tp; - el_action_t *map, *alt; - const el_action_t *dmap, *dalt; - new[1] = old[1] = '\0'; - - map = el->el_map.key; - alt = el->el_map.alt; - if (el->el_map.type == MAP_VI) { - dmap = el->el_map.vii; - dalt = el->el_map.vic; - } else { - dmap = el->el_map.emacs; - dalt = NULL; - } - - for (tp = tty_map; tp->nch != (Int)-1; tp++) { - new[0] = t_n[tp->nch]; - old[0] = t_o[tp->och]; - if (new[0] == old[0] && !force) - continue; - /* Put the old default binding back, and set the new binding */ - keymacro_clear(el, map, old); - map[UC(old[0])] = dmap[UC(old[0])]; - keymacro_clear(el, map, new); - /* MAP_VI == 1, MAP_EMACS == 0... */ - map[UC(new[0])] = tp->bind[el->el_map.type]; - if (dalt) { - keymacro_clear(el, alt, old); - alt[UC(old[0])] = dalt[UC(old[0])]; - keymacro_clear(el, alt, new); - alt[UC(new[0])] = tp->bind[el->el_map.type + 1]; - } - } -} - - -/* tty_rawmode(): - * Set terminal into 1 character at a time mode. - */ -protected int -tty_rawmode(EditLine *el) -{ - - if (el->el_tty.t_mode == ED_IO || el->el_tty.t_mode == QU_IO) - return 0; - - if (el->el_flags & EDIT_DISABLED) - return 0; - - if (tty_getty(el, &el->el_tty.t_ts) == -1) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "tty_rawmode: tty_getty: %s\n", - strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - /* - * We always keep up with the eight bit setting and the speed of the - * tty. But we only believe changes that are made to cooked mode! - */ - el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ts); - el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ts); - - if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed || - tty__getspeed(&el->el_tty.t_ed) != el->el_tty.t_speed) { - (void) cfsetispeed(&el->el_tty.t_ex, el->el_tty.t_speed); - (void) cfsetospeed(&el->el_tty.t_ex, el->el_tty.t_speed); - (void) cfsetispeed(&el->el_tty.t_ed, el->el_tty.t_speed); - (void) cfsetospeed(&el->el_tty.t_ed, el->el_tty.t_speed); - } - if (tty__cooked_mode(&el->el_tty.t_ts)) { - if (el->el_tty.t_ts.c_cflag != el->el_tty.t_ex.c_cflag) { - el->el_tty.t_ex.c_cflag = - el->el_tty.t_ts.c_cflag; - el->el_tty.t_ex.c_cflag &= - ~el->el_tty.t_t[EX_IO][MD_CTL].t_clrmask; - el->el_tty.t_ex.c_cflag |= - el->el_tty.t_t[EX_IO][MD_CTL].t_setmask; - - el->el_tty.t_ed.c_cflag = - el->el_tty.t_ts.c_cflag; - el->el_tty.t_ed.c_cflag &= - ~el->el_tty.t_t[ED_IO][MD_CTL].t_clrmask; - el->el_tty.t_ed.c_cflag |= - el->el_tty.t_t[ED_IO][MD_CTL].t_setmask; - } - if ((el->el_tty.t_ts.c_lflag != el->el_tty.t_ex.c_lflag) && - (el->el_tty.t_ts.c_lflag != el->el_tty.t_ed.c_lflag)) { - el->el_tty.t_ex.c_lflag = - el->el_tty.t_ts.c_lflag; - el->el_tty.t_ex.c_lflag &= - ~el->el_tty.t_t[EX_IO][MD_LIN].t_clrmask; - el->el_tty.t_ex.c_lflag |= - el->el_tty.t_t[EX_IO][MD_LIN].t_setmask; - - el->el_tty.t_ed.c_lflag = - el->el_tty.t_ts.c_lflag; - el->el_tty.t_ed.c_lflag &= - ~el->el_tty.t_t[ED_IO][MD_LIN].t_clrmask; - el->el_tty.t_ed.c_lflag |= - el->el_tty.t_t[ED_IO][MD_LIN].t_setmask; - } - if ((el->el_tty.t_ts.c_iflag != el->el_tty.t_ex.c_iflag) && - (el->el_tty.t_ts.c_iflag != el->el_tty.t_ed.c_iflag)) { - el->el_tty.t_ex.c_iflag = - el->el_tty.t_ts.c_iflag; - el->el_tty.t_ex.c_iflag &= - ~el->el_tty.t_t[EX_IO][MD_INP].t_clrmask; - el->el_tty.t_ex.c_iflag |= - el->el_tty.t_t[EX_IO][MD_INP].t_setmask; - - el->el_tty.t_ed.c_iflag = - el->el_tty.t_ts.c_iflag; - el->el_tty.t_ed.c_iflag &= - ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask; - el->el_tty.t_ed.c_iflag |= - el->el_tty.t_t[ED_IO][MD_INP].t_setmask; - } - if ((el->el_tty.t_ts.c_oflag != el->el_tty.t_ex.c_oflag) && - (el->el_tty.t_ts.c_oflag != el->el_tty.t_ed.c_oflag)) { - el->el_tty.t_ex.c_oflag = - el->el_tty.t_ts.c_oflag; - el->el_tty.t_ex.c_oflag &= - ~el->el_tty.t_t[EX_IO][MD_OUT].t_clrmask; - el->el_tty.t_ex.c_oflag |= - el->el_tty.t_t[EX_IO][MD_OUT].t_setmask; - - el->el_tty.t_ed.c_oflag = - el->el_tty.t_ts.c_oflag; - el->el_tty.t_ed.c_oflag &= - ~el->el_tty.t_t[ED_IO][MD_OUT].t_clrmask; - el->el_tty.t_ed.c_oflag |= - el->el_tty.t_t[ED_IO][MD_OUT].t_setmask; - } - if (tty__gettabs(&el->el_tty.t_ex) == 0) - el->el_tty.t_tabs = 0; - else - el->el_tty.t_tabs = EL_CAN_TAB ? 1 : 0; - - { - int i; - - tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[TS_IO]); - /* - * Check if the user made any changes. - * If he did, then propagate the changes to the - * edit and execute data structures. - */ - for (i = 0; i < C_NCC; i++) - if (el->el_tty.t_c[TS_IO][i] != - el->el_tty.t_c[EX_IO][i]) - break; - - if (i != C_NCC) { - /* - * Propagate changes only to the unprotected - * chars that have been modified just now. - */ - for (i = 0; i < C_NCC; i++) { - if (!((el->el_tty.t_t[ED_IO][MD_CHAR].t_setmask & C_SH(i))) - && (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i])) - el->el_tty.t_c[ED_IO][i] = el->el_tty.t_c[TS_IO][i]; - if (el->el_tty.t_t[ED_IO][MD_CHAR].t_clrmask & C_SH(i)) - el->el_tty.t_c[ED_IO][i] = el->el_tty.t_vdisable; - } - tty_bind_char(el, 0); - tty__setchar(&el->el_tty.t_ed, el->el_tty.t_c[ED_IO]); - - for (i = 0; i < C_NCC; i++) { - if (!((el->el_tty.t_t[EX_IO][MD_CHAR].t_setmask & C_SH(i))) - && (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i])) - el->el_tty.t_c[EX_IO][i] = el->el_tty.t_c[TS_IO][i]; - if (el->el_tty.t_t[EX_IO][MD_CHAR].t_clrmask & C_SH(i)) - el->el_tty.t_c[EX_IO][i] = el->el_tty.t_vdisable; - } - tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]); - } - } - } - if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", - strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - el->el_tty.t_mode = ED_IO; - return 0; -} - - -/* tty_cookedmode(): - * Set the tty back to normal mode - */ -protected int -tty_cookedmode(EditLine *el) -{ /* set tty in normal setup */ - - if (el->el_tty.t_mode == EX_IO) - return 0; - - if (el->el_flags & EDIT_DISABLED) - return 0; - - if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ex) == -1) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, - "tty_cookedmode: tty_setty: %s\n", - strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - el->el_tty.t_mode = EX_IO; - return 0; -} - - -/* tty_quotemode(): - * Turn on quote mode - */ -protected int -tty_quotemode(EditLine *el) -{ - if (el->el_tty.t_mode == QU_IO) - return 0; - - el->el_tty.t_qu = el->el_tty.t_ed; - - el->el_tty.t_qu.c_iflag &= ~el->el_tty.t_t[QU_IO][MD_INP].t_clrmask; - el->el_tty.t_qu.c_iflag |= el->el_tty.t_t[QU_IO][MD_INP].t_setmask; - - el->el_tty.t_qu.c_oflag &= ~el->el_tty.t_t[QU_IO][MD_OUT].t_clrmask; - el->el_tty.t_qu.c_oflag |= el->el_tty.t_t[QU_IO][MD_OUT].t_setmask; - - el->el_tty.t_qu.c_cflag &= ~el->el_tty.t_t[QU_IO][MD_CTL].t_clrmask; - el->el_tty.t_qu.c_cflag |= el->el_tty.t_t[QU_IO][MD_CTL].t_setmask; - - el->el_tty.t_qu.c_lflag &= ~el->el_tty.t_t[QU_IO][MD_LIN].t_clrmask; - el->el_tty.t_qu.c_lflag |= el->el_tty.t_t[QU_IO][MD_LIN].t_setmask; - - if (tty_setty(el, TCSADRAIN, &el->el_tty.t_qu) == -1) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", - strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - el->el_tty.t_mode = QU_IO; - return 0; -} - - -/* tty_noquotemode(): - * Turn off quote mode - */ -protected int -tty_noquotemode(EditLine *el) -{ - - if (el->el_tty.t_mode != QU_IO) - return 0; - if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", - strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - el->el_tty.t_mode = ED_IO; - return 0; -} - - -/* tty_stty(): - * Stty builtin - */ -protected int -/*ARGSUSED*/ -tty_stty(EditLine *el, int argc __attribute__((__unused__)), const Char **argv) -{ - const ttymodes_t *m; - char x; - int aflag = 0; - const Char *s, *d; - char name[EL_BUFSIZ]; - struct termios *tios = &el->el_tty.t_ex; - int z = EX_IO; - - if (argv == NULL) - return -1; - strncpy(name, ct_encode_string(*argv++, &el->el_scratch), sizeof(name)); - name[sizeof(name) - 1] = '\0'; - - while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0') - switch (argv[0][1]) { - case 'a': - aflag++; - argv++; - break; - case 'd': - argv++; - tios = &el->el_tty.t_ed; - z = ED_IO; - break; - case 'x': - argv++; - tios = &el->el_tty.t_ex; - z = EX_IO; - break; - case 'q': - argv++; - tios = &el->el_tty.t_ts; - z = QU_IO; - break; - default: - (void) fprintf(el->el_errfile, - "%s: Unknown switch `%c'.\n", - name, (int) argv[0][1]); - return -1; - } - - if (!argv || !*argv) { - int i = -1; - size_t len = 0, st = 0, cu; - for (m = ttymodes; m->m_name; m++) { - if (m->m_type != i) { - (void) fprintf(el->el_outfile, "%s%s", - i != -1 ? "\n" : "", - el->el_tty.t_t[z][m->m_type].t_name); - i = m->m_type; - st = len = - strlen(el->el_tty.t_t[z][m->m_type].t_name); - } - if (i != -1) { - x = (el->el_tty.t_t[z][i].t_setmask & m->m_value) - ? '+' : '\0'; - - if (el->el_tty.t_t[z][i].t_clrmask & m->m_value) - x = '-'; - } else { - x = '\0'; - } - - if (x != '\0' || aflag) { - - cu = strlen(m->m_name) + (x != '\0') + 1; - - if (len + cu >= (size_t)el->el_terminal.t_size.h) { - (void) fprintf(el->el_outfile, "\n%*s", - (int)st, ""); - len = st + cu; - } else - len += cu; - - if (x != '\0') - (void) fprintf(el->el_outfile, "%c%s ", - x, m->m_name); - else - (void) fprintf(el->el_outfile, "%s ", - m->m_name); - } - } - (void) fprintf(el->el_outfile, "\n"); - return 0; - } - while (argv && (s = *argv++)) { - const Char *p; - switch (*s) { - case '+': - case '-': - x = (char)*s++; - break; - default: - x = '\0'; - break; - } - d = s; - p = Strchr(s, '='); - for (m = ttymodes; m->m_name; m++) - if ((p ? strncmp(m->m_name, ct_encode_string(d, &el->el_scratch), (size_t)(p - d)) : - strcmp(m->m_name, ct_encode_string(d, &el->el_scratch))) == 0 && - (p == NULL || m->m_type == MD_CHAR)) - break; - - if (!m->m_name) { - (void) fprintf(el->el_errfile, - "%s: Invalid argument `" FSTR "'.\n", name, d); - return -1; - } - if (p) { - int c = ffs((int)m->m_value); - int v = *++p ? parse__escape(&p) : - el->el_tty.t_vdisable; - assert(c != 0); - c--; - c = tty__getcharindex(c); - assert(c != -1); - tios->c_cc[c] = (cc_t)v; - continue; - } - switch (x) { - case '+': - el->el_tty.t_t[z][m->m_type].t_setmask |= m->m_value; - el->el_tty.t_t[z][m->m_type].t_clrmask &= ~m->m_value; - break; - case '-': - el->el_tty.t_t[z][m->m_type].t_setmask &= ~m->m_value; - el->el_tty.t_t[z][m->m_type].t_clrmask |= m->m_value; - break; - default: - el->el_tty.t_t[z][m->m_type].t_setmask &= ~m->m_value; - el->el_tty.t_t[z][m->m_type].t_clrmask &= ~m->m_value; - break; - } - } - - if (el->el_tty.t_mode == z) { - if (tty_setty(el, TCSADRAIN, tios) == -1) { -#ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, - "tty_stty: tty_setty: %s\n", strerror(errno)); -#endif /* DEBUG_TTY */ - return -1; - } - } - - return 0; -} - - -#ifdef notyet -/* tty_printchar(): - * DEbugging routine to print the tty characters - */ -private void -tty_printchar(EditLine *el, unsigned char *s) -{ - ttyperm_t *m; - int i; - - for (i = 0; i < C_NCC; i++) { - for (m = el->el_tty.t_t; m->m_name; m++) - if (m->m_type == MD_CHAR && C_SH(i) == m->m_value) - break; - if (m->m_name) - (void) fprintf(el->el_errfile, "%s ^%c ", - m->m_name, s[i] + 'A' - 1); - if (i % 5 == 0) - (void) fprintf(el->el_errfile, "\n"); - } - (void) fprintf(el->el_errfile, "\n"); -} -#endif /* notyet */ diff --git a/cmd-line-utils/libedit/tty.h b/cmd-line-utils/libedit/tty.h deleted file mode 100644 index 04485eb83ad..00000000000 --- a/cmd-line-utils/libedit/tty.h +++ /dev/null @@ -1,481 +0,0 @@ -/* $NetBSD: tty.h,v 1.13 2011/08/16 16:25:15 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tty.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * el.tty.h: Local terminal header - */ -#ifndef _h_el_tty -#define _h_el_tty - -#include "sys.h" -#include "histedit.h" -#include -#include - -/* Define our own since everyone gets it wrong! */ -#define CONTROL(A) ((A) & 037) - -/* - * Aix compatible names - */ -# if defined(VWERSE) && !defined(VWERASE) -# define VWERASE VWERSE -# endif /* VWERSE && !VWERASE */ - -# if defined(VDISCRD) && !defined(VDISCARD) -# define VDISCARD VDISCRD -# endif /* VDISCRD && !VDISCARD */ - -# if defined(VFLUSHO) && !defined(VDISCARD) -# define VDISCARD VFLUSHO -# endif /* VFLUSHO && VDISCARD */ - -# if defined(VSTRT) && !defined(VSTART) -# define VSTART VSTRT -# endif /* VSTRT && ! VSTART */ - -# if defined(VSTAT) && !defined(VSTATUS) -# define VSTATUS VSTAT -# endif /* VSTAT && ! VSTATUS */ - -# ifndef ONLRET -# define ONLRET 0 -# endif /* ONLRET */ - -# ifndef TAB3 -# ifdef OXTABS -# define TAB3 OXTABS -# else -# define TAB3 0 -# endif /* OXTABS */ -# endif /* !TAB3 */ - -# if defined(OXTABS) && !defined(XTABS) -# define XTABS OXTABS -# endif /* OXTABS && !XTABS */ - -# ifndef ONLCR -# define ONLCR 0 -# endif /* ONLCR */ - -# ifndef IEXTEN -# define IEXTEN 0 -# endif /* IEXTEN */ - -# ifndef ECHOCTL -# define ECHOCTL 0 -# endif /* ECHOCTL */ - -# ifndef PARENB -# define PARENB 0 -# endif /* PARENB */ - -# ifndef EXTPROC -# define EXTPROC 0 -# endif /* EXTPROC */ - -# ifndef FLUSHO -# define FLUSHO 0 -# endif /* FLUSHO */ - - -# if defined(VDISABLE) && !defined(_POSIX_VDISABLE) -# define _POSIX_VDISABLE VDISABLE -# endif /* VDISABLE && ! _POSIX_VDISABLE */ - -/* - * Work around ISC's definition of IEXTEN which is - * XCASE! - */ -# ifdef ISC -# if defined(IEXTEN) && defined(XCASE) -# if IEXTEN == XCASE -# undef IEXTEN -# define IEXTEN 0 -# endif /* IEXTEN == XCASE */ -# endif /* IEXTEN && XCASE */ -# if defined(IEXTEN) && !defined(XCASE) -# define XCASE IEXTEN -# undef IEXTEN -# define IEXTEN 0 -# endif /* IEXTEN && !XCASE */ -# endif /* ISC */ - -/* - * Work around convex weirdness where turning off IEXTEN makes us - * lose all postprocessing! - */ -#if defined(convex) || defined(__convex__) -# if defined(IEXTEN) && IEXTEN != 0 -# undef IEXTEN -# define IEXTEN 0 -# endif /* IEXTEN != 0 */ -#endif /* convex || __convex__ */ - -/* - * So that we don't lose job control. - */ -#ifdef __SVR4 -# undef CSWTCH -#endif - -#ifndef _POSIX_VDISABLE -# define _POSIX_VDISABLE ((unsigned char) -1) -#endif /* _POSIX_VDISABLE */ - -#if !defined(CREPRINT) && defined(CRPRNT) -# define CREPRINT CRPRNT -#endif /* !CREPRINT && CRPRNT */ -#if !defined(CDISCARD) && defined(CFLUSH) -# define CDISCARD CFLUSH -#endif /* !CDISCARD && CFLUSH */ - -#ifndef CINTR -# define CINTR CONTROL('c') -#endif /* CINTR */ -#ifndef CQUIT -# define CQUIT 034 /* ^\ */ -#endif /* CQUIT */ -#ifndef CERASE -# define CERASE 0177 /* ^? */ -#endif /* CERASE */ -#ifndef CKILL -# define CKILL CONTROL('u') -#endif /* CKILL */ -#ifndef CEOF -# define CEOF CONTROL('d') -#endif /* CEOF */ -#ifndef CEOL -# define CEOL _POSIX_VDISABLE -#endif /* CEOL */ -#ifndef CEOL2 -# define CEOL2 _POSIX_VDISABLE -#endif /* CEOL2 */ -#ifndef CSWTCH -# define CSWTCH _POSIX_VDISABLE -#endif /* CSWTCH */ -#ifndef CDSWTCH -# define CDSWTCH _POSIX_VDISABLE -#endif /* CDSWTCH */ -#ifndef CERASE2 -# define CERASE2 _POSIX_VDISABLE -#endif /* CERASE2 */ -#ifndef CSTART -# define CSTART CONTROL('q') -#endif /* CSTART */ -#ifndef CSTOP -# define CSTOP CONTROL('s') -#endif /* CSTOP */ -#ifndef CSUSP -# define CSUSP CONTROL('z') -#endif /* CSUSP */ -#ifndef CDSUSP -# define CDSUSP CONTROL('y') -#endif /* CDSUSP */ - -#ifdef hpux - -# ifndef CREPRINT -# define CREPRINT _POSIX_VDISABLE -# endif /* CREPRINT */ -# ifndef CDISCARD -# define CDISCARD _POSIX_VDISABLE -# endif /* CDISCARD */ -# ifndef CLNEXT -# define CLNEXT _POSIX_VDISABLE -# endif /* CLNEXT */ -# ifndef CWERASE -# define CWERASE _POSIX_VDISABLE -# endif /* CWERASE */ - -#else /* !hpux */ - -# ifndef CREPRINT -# define CREPRINT CONTROL('r') -# endif /* CREPRINT */ -# ifndef CDISCARD -# define CDISCARD CONTROL('o') -# endif /* CDISCARD */ -# ifndef CLNEXT -# define CLNEXT CONTROL('v') -# endif /* CLNEXT */ -# ifndef CWERASE -# define CWERASE CONTROL('w') -# endif /* CWERASE */ - -#endif /* hpux */ - -#ifndef CSTATUS -# define CSTATUS CONTROL('t') -#endif /* CSTATUS */ -#ifndef CPAGE -# define CPAGE ' ' -#endif /* CPAGE */ -#ifndef CPGOFF -# define CPGOFF CONTROL('m') -#endif /* CPGOFF */ -#ifndef CKILL2 -# define CKILL2 _POSIX_VDISABLE -#endif /* CKILL2 */ -#ifndef CBRK -# ifndef masscomp -# define CBRK 0377 -# else -# define CBRK '\0' -# endif /* masscomp */ -#endif /* CBRK */ -#ifndef CMIN -# define CMIN CEOF -#endif /* CMIN */ -#ifndef CTIME -# define CTIME CEOL -#endif /* CTIME */ - -/* - * Fix for sun inconsistency. On termio VSUSP and the rest of the - * ttychars > NCC are defined. So we undefine them. - */ -#if defined(TERMIO) || defined(POSIX) -# if defined(POSIX) && defined(NCCS) -# define NUMCC NCCS -# else -# ifdef NCC -# define NUMCC NCC -# endif /* NCC */ -# endif /* POSIX && NCCS */ -# ifdef NUMCC -# ifdef VINTR -# if NUMCC <= VINTR -# undef VINTR -# endif /* NUMCC <= VINTR */ -# endif /* VINTR */ -# ifdef VQUIT -# if NUMCC <= VQUIT -# undef VQUIT -# endif /* NUMCC <= VQUIT */ -# endif /* VQUIT */ -# ifdef VERASE -# if NUMCC <= VERASE -# undef VERASE -# endif /* NUMCC <= VERASE */ -# endif /* VERASE */ -# ifdef VKILL -# if NUMCC <= VKILL -# undef VKILL -# endif /* NUMCC <= VKILL */ -# endif /* VKILL */ -# ifdef VEOF -# if NUMCC <= VEOF -# undef VEOF -# endif /* NUMCC <= VEOF */ -# endif /* VEOF */ -# ifdef VEOL -# if NUMCC <= VEOL -# undef VEOL -# endif /* NUMCC <= VEOL */ -# endif /* VEOL */ -# ifdef VEOL2 -# if NUMCC <= VEOL2 -# undef VEOL2 -# endif /* NUMCC <= VEOL2 */ -# endif /* VEOL2 */ -# ifdef VSWTCH -# if NUMCC <= VSWTCH -# undef VSWTCH -# endif /* NUMCC <= VSWTCH */ -# endif /* VSWTCH */ -# ifdef VDSWTCH -# if NUMCC <= VDSWTCH -# undef VDSWTCH -# endif /* NUMCC <= VDSWTCH */ -# endif /* VDSWTCH */ -# ifdef VERASE2 -# if NUMCC <= VERASE2 -# undef VERASE2 -# endif /* NUMCC <= VERASE2 */ -# endif /* VERASE2 */ -# ifdef VSTART -# if NUMCC <= VSTART -# undef VSTART -# endif /* NUMCC <= VSTART */ -# endif /* VSTART */ -# ifdef VSTOP -# if NUMCC <= VSTOP -# undef VSTOP -# endif /* NUMCC <= VSTOP */ -# endif /* VSTOP */ -# ifdef VWERASE -# if NUMCC <= VWERASE -# undef VWERASE -# endif /* NUMCC <= VWERASE */ -# endif /* VWERASE */ -# ifdef VSUSP -# if NUMCC <= VSUSP -# undef VSUSP -# endif /* NUMCC <= VSUSP */ -# endif /* VSUSP */ -# ifdef VDSUSP -# if NUMCC <= VDSUSP -# undef VDSUSP -# endif /* NUMCC <= VDSUSP */ -# endif /* VDSUSP */ -# ifdef VREPRINT -# if NUMCC <= VREPRINT -# undef VREPRINT -# endif /* NUMCC <= VREPRINT */ -# endif /* VREPRINT */ -# ifdef VDISCARD -# if NUMCC <= VDISCARD -# undef VDISCARD -# endif /* NUMCC <= VDISCARD */ -# endif /* VDISCARD */ -# ifdef VLNEXT -# if NUMCC <= VLNEXT -# undef VLNEXT -# endif /* NUMCC <= VLNEXT */ -# endif /* VLNEXT */ -# ifdef VSTATUS -# if NUMCC <= VSTATUS -# undef VSTATUS -# endif /* NUMCC <= VSTATUS */ -# endif /* VSTATUS */ -# ifdef VPAGE -# if NUMCC <= VPAGE -# undef VPAGE -# endif /* NUMCC <= VPAGE */ -# endif /* VPAGE */ -# ifdef VPGOFF -# if NUMCC <= VPGOFF -# undef VPGOFF -# endif /* NUMCC <= VPGOFF */ -# endif /* VPGOFF */ -# ifdef VKILL2 -# if NUMCC <= VKILL2 -# undef VKILL2 -# endif /* NUMCC <= VKILL2 */ -# endif /* VKILL2 */ -# ifdef VBRK -# if NUMCC <= VBRK -# undef VBRK -# endif /* NUMCC <= VBRK */ -# endif /* VBRK */ -# ifdef VMIN -# if NUMCC <= VMIN -# undef VMIN -# endif /* NUMCC <= VMIN */ -# endif /* VMIN */ -# ifdef VTIME -# if NUMCC <= VTIME -# undef VTIME -# endif /* NUMCC <= VTIME */ -# endif /* VTIME */ -# endif /* NUMCC */ -#endif /* !POSIX */ - -#define C_INTR 0 -#define C_QUIT 1 -#define C_ERASE 2 -#define C_KILL 3 -#define C_EOF 4 -#define C_EOL 5 -#define C_EOL2 6 -#define C_SWTCH 7 -#define C_DSWTCH 8 -#define C_ERASE2 9 -#define C_START 10 -#define C_STOP 11 -#define C_WERASE 12 -#define C_SUSP 13 -#define C_DSUSP 14 -#define C_REPRINT 15 -#define C_DISCARD 16 -#define C_LNEXT 17 -#define C_STATUS 18 -#define C_PAGE 19 -#define C_PGOFF 20 -#define C_KILL2 21 -#define C_BRK 22 -#define C_MIN 23 -#define C_TIME 24 -#define C_NCC 25 -#define C_SH(A) ((unsigned int)(1 << (A))) - -/* - * Terminal dependend data structures - */ -#define EX_IO 0 /* while we are executing */ -#define ED_IO 1 /* while we are editing */ -#define TS_IO 2 /* new mode from terminal */ -#define QU_IO 2 /* used only for quoted chars */ -#define NN_IO 3 /* The number of entries */ - -#define MD_INP 0 -#define MD_OUT 1 -#define MD_CTL 2 -#define MD_LIN 3 -#define MD_CHAR 4 -#define MD_NN 5 - -typedef struct { - const char *t_name; - unsigned int t_setmask; - unsigned 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_rawmode(EditLine *); -protected int tty_cookedmode(EditLine *); -protected int tty_quotemode(EditLine *); -protected int tty_noquotemode(EditLine *); -protected void tty_bind_char(EditLine *, int); - -typedef struct { - ttyperm_t t_t; - ttychar_t t_c; - struct termios t_ex, t_ed, t_ts; - int t_tabs; - int t_eight; - speed_t t_speed; - int t_mode; - unsigned char t_vdisable; -} el_tty_t; - - -#endif /* _h_el_tty */ diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c deleted file mode 100644 index 9a4b97a977e..00000000000 --- a/cmd-line-utils/libedit/vi.c +++ /dev/null @@ -1,1173 +0,0 @@ -/* $NetBSD: vi.c,v 1.41 2011/10/04 15:27:04 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Christos Zoulas of Cornell University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" -#include -#include -#include -#include - -#if !defined(lint) && !defined(SCCSID) -#if 0 -static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93"; -#else -#endif -#endif /* not lint && not SCCSID */ - -/* - * vi.c: Vi mode commands. - */ -#include "el.h" - -private el_action_t cv_action(EditLine *, Int); -private el_action_t cv_paste(EditLine *, Int); - -/* cv_action(): - * Handle vi actions. - */ -private el_action_t -cv_action(EditLine *el, Int c) -{ - - if (el->el_chared.c_vcmd.action != NOP) { - /* 'cc', 'dd' and (possibly) friends */ - if (c != (Int)el->el_chared.c_vcmd.action) - return CC_ERROR; - - if (!(c & YANK)) - cv_undo(el); - cv_yank(el, el->el_line.buffer, - (int)(el->el_line.lastchar - el->el_line.buffer)); - el->el_chared.c_vcmd.action = NOP; - el->el_chared.c_vcmd.pos = 0; - if (!(c & YANK)) { - el->el_line.lastchar = el->el_line.buffer; - el->el_line.cursor = el->el_line.buffer; - } - if (c & INSERT) - el->el_map.current = el->el_map.key; - - return CC_REFRESH; - } - el->el_chared.c_vcmd.pos = el->el_line.cursor; - el->el_chared.c_vcmd.action = c; - return CC_ARGHACK; -} - -/* cv_paste(): - * Paste previous deletion before or after the cursor - */ -private el_action_t -cv_paste(EditLine *el, Int c) -{ - c_kill_t *k = &el->el_chared.c_kill; - size_t len = (size_t)(k->last - k->buf); - - if (k->buf == NULL || len == 0) - return CC_ERROR; -#ifdef DEBUG_PASTE - (void) fprintf(el->el_errfile, "Paste: \"%.*s\"\n", (int)len, k->buf); -#endif - - cv_undo(el); - - if (!c && el->el_line.cursor < el->el_line.lastchar) - el->el_line.cursor++; - - c_insert(el, (int)len); - if (el->el_line.cursor + len > el->el_line.lastchar) - return CC_ERROR; - (void) memcpy(el->el_line.cursor, k->buf, len * - sizeof(*el->el_line.cursor)); - - return CC_REFRESH; -} - - -/* vi_paste_next(): - * Vi paste previous deletion to the right of the cursor - * [p] - */ -protected el_action_t -/*ARGSUSED*/ -vi_paste_next(EditLine *el, Int c __attribute__((__unused__))) -{ - - return cv_paste(el, 0); -} - - -/* vi_paste_prev(): - * Vi paste previous deletion to the left of the cursor - * [P] - */ -protected el_action_t -/*ARGSUSED*/ -vi_paste_prev(EditLine *el, Int c __attribute__((__unused__))) -{ - - return cv_paste(el, 1); -} - - -/* vi_prev_big_word(): - * Vi move to the previous space delimited word - * [B] - */ -protected el_action_t -/*ARGSUSED*/ -vi_prev_big_word(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor == el->el_line.buffer) - return CC_ERROR; - - el->el_line.cursor = cv_prev_word(el->el_line.cursor, - el->el_line.buffer, - el->el_state.argument, - cv__isWord); - - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* vi_prev_word(): - * Vi move to the previous word - * [b] - */ -protected el_action_t -/*ARGSUSED*/ -vi_prev_word(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor == el->el_line.buffer) - return CC_ERROR; - - el->el_line.cursor = cv_prev_word(el->el_line.cursor, - el->el_line.buffer, - el->el_state.argument, - cv__isword); - - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* vi_next_big_word(): - * Vi move to the next space delimited word - * [W] - */ -protected el_action_t -/*ARGSUSED*/ -vi_next_big_word(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor >= el->el_line.lastchar - 1) - return CC_ERROR; - - el->el_line.cursor = cv_next_word(el, el->el_line.cursor, - el->el_line.lastchar, el->el_state.argument, cv__isWord); - - if (el->el_map.type == MAP_VI) - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* vi_next_word(): - * Vi move to the next word - * [w] - */ -protected el_action_t -/*ARGSUSED*/ -vi_next_word(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor >= el->el_line.lastchar - 1) - return CC_ERROR; - - el->el_line.cursor = cv_next_word(el, el->el_line.cursor, - el->el_line.lastchar, el->el_state.argument, cv__isword); - - if (el->el_map.type == MAP_VI) - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* vi_change_case(): - * Vi change case of character under the cursor and advance one character - * [~] - */ -protected el_action_t -vi_change_case(EditLine *el, Int c) -{ - int i; - - if (el->el_line.cursor >= el->el_line.lastchar) - return CC_ERROR; - cv_undo(el); - for (i = 0; i < el->el_state.argument; i++) { - - c = *el->el_line.cursor; - if (Isupper(c)) - *el->el_line.cursor = Tolower(c); - else if (Islower(c)) - *el->el_line.cursor = Toupper(c); - - if (++el->el_line.cursor >= el->el_line.lastchar) { - el->el_line.cursor--; - re_fastaddc(el); - break; - } - re_fastaddc(el); - } - return CC_NORM; -} - - -/* vi_change_meta(): - * Vi change prefix command - * [c] - */ -protected el_action_t -/*ARGSUSED*/ -vi_change_meta(EditLine *el, Int c __attribute__((__unused__))) -{ - - /* - * Delete with insert == change: first we delete and then we leave in - * insert mode. - */ - return cv_action(el, DELETE | INSERT); -} - - -/* vi_insert_at_bol(): - * Vi enter insert mode at the beginning of line - * [I] - */ -protected el_action_t -/*ARGSUSED*/ -vi_insert_at_bol(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_line.cursor = el->el_line.buffer; - cv_undo(el); - el->el_map.current = el->el_map.key; - return CC_CURSOR; -} - - -/* vi_replace_char(): - * Vi replace character under the cursor with the next character typed - * [r] - */ -protected el_action_t -/*ARGSUSED*/ -vi_replace_char(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor >= el->el_line.lastchar) - return CC_ERROR; - - el->el_map.current = el->el_map.key; - el->el_state.inputmode = MODE_REPLACE_1; - cv_undo(el); - return CC_ARGHACK; -} - - -/* vi_replace_mode(): - * Vi enter replace mode - * [R] - */ -protected el_action_t -/*ARGSUSED*/ -vi_replace_mode(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_map.current = el->el_map.key; - el->el_state.inputmode = MODE_REPLACE; - cv_undo(el); - return CC_NORM; -} - - -/* vi_substitute_char(): - * Vi replace character under the cursor and enter insert mode - * [s] - */ -protected el_action_t -/*ARGSUSED*/ -vi_substitute_char(EditLine *el, Int c __attribute__((__unused__))) -{ - - c_delafter(el, el->el_state.argument); - el->el_map.current = el->el_map.key; - return CC_REFRESH; -} - - -/* vi_substitute_line(): - * Vi substitute entire line - * [S] - */ -protected el_action_t -/*ARGSUSED*/ -vi_substitute_line(EditLine *el, Int c __attribute__((__unused__))) -{ - - cv_undo(el); - cv_yank(el, el->el_line.buffer, - (int)(el->el_line.lastchar - el->el_line.buffer)); - (void) em_kill_line(el, 0); - el->el_map.current = el->el_map.key; - return CC_REFRESH; -} - - -/* vi_change_to_eol(): - * Vi change to end of line - * [C] - */ -protected el_action_t -/*ARGSUSED*/ -vi_change_to_eol(EditLine *el, Int c __attribute__((__unused__))) -{ - - cv_undo(el); - cv_yank(el, el->el_line.cursor, - (int)(el->el_line.lastchar - el->el_line.cursor)); - (void) ed_kill_line(el, 0); - el->el_map.current = el->el_map.key; - return CC_REFRESH; -} - - -/* vi_insert(): - * Vi enter insert mode - * [i] - */ -protected el_action_t -/*ARGSUSED*/ -vi_insert(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_map.current = el->el_map.key; - cv_undo(el); - return CC_NORM; -} - - -/* vi_add(): - * Vi enter insert mode after the cursor - * [a] - */ -protected el_action_t -/*ARGSUSED*/ -vi_add(EditLine *el, Int c __attribute__((__unused__))) -{ - int ret; - - el->el_map.current = el->el_map.key; - if (el->el_line.cursor < el->el_line.lastchar) { - el->el_line.cursor++; - if (el->el_line.cursor > el->el_line.lastchar) - el->el_line.cursor = el->el_line.lastchar; - ret = CC_CURSOR; - } else - ret = CC_NORM; - - cv_undo(el); - - return (el_action_t)ret; -} - - -/* vi_add_at_eol(): - * Vi enter insert mode at end of line - * [A] - */ -protected el_action_t -/*ARGSUSED*/ -vi_add_at_eol(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_map.current = el->el_map.key; - el->el_line.cursor = el->el_line.lastchar; - cv_undo(el); - return CC_CURSOR; -} - - -/* vi_delete_meta(): - * Vi delete prefix command - * [d] - */ -protected el_action_t -/*ARGSUSED*/ -vi_delete_meta(EditLine *el, Int c __attribute__((__unused__))) -{ - - return cv_action(el, DELETE); -} - - -/* vi_end_big_word(): - * Vi move to the end of the current space delimited word - * [E] - */ -protected el_action_t -/*ARGSUSED*/ -vi_end_big_word(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor == el->el_line.lastchar) - return CC_ERROR; - - el->el_line.cursor = cv__endword(el->el_line.cursor, - el->el_line.lastchar, el->el_state.argument, cv__isWord); - - if (el->el_chared.c_vcmd.action != NOP) { - el->el_line.cursor++; - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* vi_end_word(): - * Vi move to the end of the current word - * [e] - */ -protected el_action_t -/*ARGSUSED*/ -vi_end_word(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor == el->el_line.lastchar) - return CC_ERROR; - - el->el_line.cursor = cv__endword(el->el_line.cursor, - el->el_line.lastchar, el->el_state.argument, cv__isword); - - if (el->el_chared.c_vcmd.action != NOP) { - el->el_line.cursor++; - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* vi_undo(): - * Vi undo last change - * [u] - */ -protected el_action_t -/*ARGSUSED*/ -vi_undo(EditLine *el, Int c __attribute__((__unused__))) -{ - c_undo_t un = el->el_chared.c_undo; - - if (un.len == -1) - return CC_ERROR; - - /* switch line buffer and undo buffer */ - el->el_chared.c_undo.buf = el->el_line.buffer; - el->el_chared.c_undo.len = el->el_line.lastchar - el->el_line.buffer; - el->el_chared.c_undo.cursor = - (int)(el->el_line.cursor - el->el_line.buffer); - el->el_line.limit = un.buf + (el->el_line.limit - el->el_line.buffer); - el->el_line.buffer = un.buf; - el->el_line.cursor = un.buf + un.cursor; - el->el_line.lastchar = un.buf + un.len; - - return CC_REFRESH; -} - - -/* vi_command_mode(): - * Vi enter command mode (use alternative key bindings) - * [] - */ -protected el_action_t -/*ARGSUSED*/ -vi_command_mode(EditLine *el, Int c __attribute__((__unused__))) -{ - - /* [Esc] cancels pending action */ - el->el_chared.c_vcmd.action = NOP; - el->el_chared.c_vcmd.pos = 0; - - el->el_state.doingarg = 0; - - el->el_state.inputmode = MODE_INSERT; - el->el_map.current = el->el_map.alt; -#ifdef VI_MOVE - if (el->el_line.cursor > el->el_line.buffer) - el->el_line.cursor--; -#endif - return CC_CURSOR; -} - - -/* vi_zero(): - * Vi move to the beginning of line - * [0] - */ -protected el_action_t -vi_zero(EditLine *el, Int c) -{ - - if (el->el_state.doingarg) - return ed_argument_digit(el, c); - - el->el_line.cursor = el->el_line.buffer; - if (el->el_chared.c_vcmd.action != NOP) { - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - - -/* vi_delete_prev_char(): - * Vi move to previous character (backspace) - * [^H] in insert mode only - */ -protected el_action_t -/*ARGSUSED*/ -vi_delete_prev_char(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_line.cursor <= el->el_line.buffer) - return CC_ERROR; - - c_delbefore1(el); - el->el_line.cursor--; - return CC_REFRESH; -} - - -/* vi_list_or_eof(): - * Vi list choices for completion or indicate end of file if empty line - * [^D] - */ -protected el_action_t -/*ARGSUSED*/ -vi_list_or_eof(EditLine *el, Int c) -{ - - if (el->el_line.cursor == el->el_line.lastchar) { - if (el->el_line.cursor == el->el_line.buffer) { - terminal_writec(el, c); /* then do a EOF */ - return CC_EOF; - } else { - /* - * Here we could list completions, but it is an - * error right now - */ - terminal_beep(el); - return CC_ERROR; - } - } else { -#ifdef notyet - re_goto_bottom(el); - *el->el_line.lastchar = '\0'; /* just in case */ - return CC_LIST_CHOICES; -#else - /* - * Just complain for now. - */ - terminal_beep(el); - return CC_ERROR; -#endif - } -} - - -/* vi_kill_line_prev(): - * Vi cut from beginning of line to cursor - * [^U] - */ -protected el_action_t -/*ARGSUSED*/ -vi_kill_line_prev(EditLine *el, Int c __attribute__((__unused__))) -{ - Char *kp, *cp; - - cp = el->el_line.buffer; - kp = el->el_chared.c_kill.buf; - while (cp < el->el_line.cursor) - *kp++ = *cp++; /* copy it */ - el->el_chared.c_kill.last = kp; - c_delbefore(el, (int)(el->el_line.cursor - el->el_line.buffer)); - el->el_line.cursor = el->el_line.buffer; /* zap! */ - return CC_REFRESH; -} - - -/* vi_search_prev(): - * Vi search history previous - * [?] - */ -protected el_action_t -/*ARGSUSED*/ -vi_search_prev(EditLine *el, Int c __attribute__((__unused__))) -{ - - return cv_search(el, ED_SEARCH_PREV_HISTORY); -} - - -/* vi_search_next(): - * Vi search history next - * [/] - */ -protected el_action_t -/*ARGSUSED*/ -vi_search_next(EditLine *el, Int c __attribute__((__unused__))) -{ - - return cv_search(el, ED_SEARCH_NEXT_HISTORY); -} - - -/* vi_repeat_search_next(): - * Vi repeat current search in the same search direction - * [n] - */ -protected el_action_t -/*ARGSUSED*/ -vi_repeat_search_next(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_search.patlen == 0) - return CC_ERROR; - else - return cv_repeat_srch(el, el->el_search.patdir); -} - - -/* vi_repeat_search_prev(): - * Vi repeat current search in the opposite search direction - * [N] - */ -/*ARGSUSED*/ -protected el_action_t -vi_repeat_search_prev(EditLine *el, Int c __attribute__((__unused__))) -{ - - if (el->el_search.patlen == 0) - return CC_ERROR; - else - return (cv_repeat_srch(el, - el->el_search.patdir == ED_SEARCH_PREV_HISTORY ? - ED_SEARCH_NEXT_HISTORY : ED_SEARCH_PREV_HISTORY)); -} - - -/* vi_next_char(): - * Vi move to the character specified next - * [f] - */ -protected el_action_t -/*ARGSUSED*/ -vi_next_char(EditLine *el, Int c __attribute__((__unused__))) -{ - return cv_csearch(el, CHAR_FWD, -1, el->el_state.argument, 0); -} - - -/* vi_prev_char(): - * Vi move to the character specified previous - * [F] - */ -protected el_action_t -/*ARGSUSED*/ -vi_prev_char(EditLine *el, Int c __attribute__((__unused__))) -{ - return cv_csearch(el, CHAR_BACK, -1, el->el_state.argument, 0); -} - - -/* vi_to_next_char(): - * Vi move up to the character specified next - * [t] - */ -protected el_action_t -/*ARGSUSED*/ -vi_to_next_char(EditLine *el, Int c __attribute__((__unused__))) -{ - return cv_csearch(el, CHAR_FWD, -1, el->el_state.argument, 1); -} - - -/* vi_to_prev_char(): - * Vi move up to the character specified previous - * [T] - */ -protected el_action_t -/*ARGSUSED*/ -vi_to_prev_char(EditLine *el, Int c __attribute__((__unused__))) -{ - return cv_csearch(el, CHAR_BACK, -1, el->el_state.argument, 1); -} - - -/* vi_repeat_next_char(): - * Vi repeat current character search in the same search direction - * [;] - */ -protected el_action_t -/*ARGSUSED*/ -vi_repeat_next_char(EditLine *el, Int c __attribute__((__unused__))) -{ - - return cv_csearch(el, el->el_search.chadir, el->el_search.chacha, - el->el_state.argument, el->el_search.chatflg); -} - - -/* vi_repeat_prev_char(): - * Vi repeat current character search in the opposite search direction - * [,] - */ -protected el_action_t -/*ARGSUSED*/ -vi_repeat_prev_char(EditLine *el, Int c __attribute__((__unused__))) -{ - el_action_t r; - int dir = el->el_search.chadir; - - r = cv_csearch(el, -dir, el->el_search.chacha, - el->el_state.argument, el->el_search.chatflg); - el->el_search.chadir = dir; - return r; -} - - -/* vi_match(): - * Vi go to matching () {} or [] - * [%] - */ -protected el_action_t -/*ARGSUSED*/ -vi_match(EditLine *el, Int c __attribute__((__unused__))) -{ - const Char match_chars[] = STR("()[]{}"); - Char *cp; - size_t delta, i, count; - Char o_ch, c_ch; - - *el->el_line.lastchar = '\0'; /* just in case */ - - i = Strcspn(el->el_line.cursor, match_chars); - o_ch = el->el_line.cursor[i]; - if (o_ch == 0) - return CC_ERROR; - delta = (size_t)(Strchr(match_chars, o_ch) - match_chars); - c_ch = match_chars[delta ^ 1]; - count = 1; - delta = 1 - (delta & 1) * 2; - - for (cp = &el->el_line.cursor[i]; count; ) { - cp += delta; - if (cp < el->el_line.buffer || cp >= el->el_line.lastchar) - return CC_ERROR; - if (*cp == o_ch) - count++; - else if (*cp == c_ch) - count--; - } - - el->el_line.cursor = cp; - - if (el->el_chared.c_vcmd.action != NOP) { - /* NB posix says char under cursor should NOT be deleted - for -ve delta - this is different to netbsd vi. */ - if (delta > 0) - el->el_line.cursor++; - cv_delfini(el); - return CC_REFRESH; - } - return CC_CURSOR; -} - -/* vi_undo_line(): - * Vi undo all changes to line - * [U] - */ -protected el_action_t -/*ARGSUSED*/ -vi_undo_line(EditLine *el, Int c __attribute__((__unused__))) -{ - - cv_undo(el); - return hist_get(el); -} - -/* vi_to_column(): - * Vi go to specified column - * [|] - * NB netbsd vi goes to screen column 'n', posix says nth character - */ -protected el_action_t -/*ARGSUSED*/ -vi_to_column(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_line.cursor = el->el_line.buffer; - el->el_state.argument--; - return ed_next_char(el, 0); -} - -/* vi_yank_end(): - * Vi yank to end of line - * [Y] - */ -protected el_action_t -/*ARGSUSED*/ -vi_yank_end(EditLine *el, Int c __attribute__((__unused__))) -{ - - cv_yank(el, el->el_line.cursor, - (int)(el->el_line.lastchar - el->el_line.cursor)); - return CC_REFRESH; -} - -/* vi_yank(): - * Vi yank - * [y] - */ -protected el_action_t -/*ARGSUSED*/ -vi_yank(EditLine *el, Int c __attribute__((__unused__))) -{ - - return cv_action(el, YANK); -} - -/* vi_comment_out(): - * Vi comment out current command - * [#] - */ -protected el_action_t -/*ARGSUSED*/ -vi_comment_out(EditLine *el, Int c __attribute__((__unused__))) -{ - - el->el_line.cursor = el->el_line.buffer; - c_insert(el, 1); - *el->el_line.cursor = '#'; - re_refresh(el); - return ed_newline(el, 0); -} - -/* vi_alias(): - * Vi include shell alias - * [@] - * NB: posix implies that we should enter insert mode, however - * this is against historical precedent... - */ -#if defined(__weak_reference) && !defined(__FreeBSD__) -__weakref_visible char *my_get_alias_text(const char *) - __weak_reference(get_alias_text); -#endif -protected el_action_t -/*ARGSUSED*/ -vi_alias(EditLine *el __attribute__((__unused__)), - Int c __attribute__((__unused__))) -{ -#if defined(__weak_reference) && !defined(__FreeBSD__) - char alias_name[3]; - char *alias_text; - - if (my_get_alias_text == 0) { - return CC_ERROR; - } - - alias_name[0] = '_'; - alias_name[2] = 0; - if (el_getc(el, &alias_name[1]) != 1) - return CC_ERROR; - - alias_text = my_get_alias_text(alias_name); - if (alias_text != NULL) - FUN(el,push)(el, ct_decode_string(alias_text, &el->el_scratch)); - return CC_NORM; -#else - return CC_ERROR; -#endif -} - -/* vi_to_history_line(): - * Vi go to specified history file line. - * [G] - */ -protected el_action_t -/*ARGSUSED*/ -vi_to_history_line(EditLine *el, Int c __attribute__((__unused__))) -{ - int sv_event_no = el->el_history.eventno; - el_action_t rval; - - - if (el->el_history.eventno == 0) { - (void) Strncpy(el->el_history.buf, el->el_line.buffer, - EL_BUFSIZ); - el->el_history.last = el->el_history.buf + - (el->el_line.lastchar - el->el_line.buffer); - } - - /* Lack of a 'count' means oldest, not 1 */ - if (!el->el_state.doingarg) { - el->el_history.eventno = 0x7fffffff; - hist_get(el); - } else { - /* This is brain dead, all the rest of this code counts - * upwards going into the past. Here we need count in the - * other direction (to match the output of fc -l). - * I could change the world, but this seems to suffice. - */ - el->el_history.eventno = 1; - if (hist_get(el) == CC_ERROR) - return CC_ERROR; - el->el_history.eventno = 1 + el->el_history.ev.num - - el->el_state.argument; - if (el->el_history.eventno < 0) { - el->el_history.eventno = sv_event_no; - return CC_ERROR; - } - } - rval = hist_get(el); - if (rval == CC_ERROR) - el->el_history.eventno = sv_event_no; - return rval; -} - -/* vi_histedit(): - * Vi edit history line with vi - * [v] - */ -protected el_action_t -/*ARGSUSED*/ -vi_histedit(EditLine *el, Int c __attribute__((__unused__))) -{ - int fd; - pid_t pid; - ssize_t st; - int status; - char tempfile[] = "/tmp/histedit.XXXXXXXXXX"; - char *cp; - size_t len; - Char *line; - mbstate_t state; - - memset(&state, 0, sizeof(mbstate_t)); - if (el->el_state.doingarg) { - if (vi_to_history_line(el, 0) == CC_ERROR) - return CC_ERROR; - } - - fd = mkstemp(tempfile); - if (fd < 0) - return CC_ERROR; - len = (size_t)(el->el_line.lastchar - el->el_line.buffer); -#define TMP_BUFSIZ (EL_BUFSIZ * MB_LEN_MAX) - cp = el_malloc(TMP_BUFSIZ * sizeof(*cp)); - if (cp == NULL) { - unlink(tempfile); - close(fd); - return CC_ERROR; - } - line = el_malloc(len * sizeof(*line)); - if (line == NULL) { - el_free(cp); - return CC_ERROR; - } - Strncpy(line, el->el_line.buffer, len); - line[len] = '\0'; - wcsrtombs(cp, (const wchar_t **) &line, TMP_BUFSIZ - 1, &state); - cp[TMP_BUFSIZ - 1] = '\0'; - len = strlen(cp); - if (write(fd, cp, len) == -1) - goto error; - if (write(fd, "\n", (size_t)1) == -1) - goto error; - pid = fork(); - switch (pid) { - case -1: - close(fd); - unlink(tempfile); - el_free(cp); - el_free(line); - return CC_ERROR; - case 0: - close(fd); - execlp("vi", "vi", tempfile, (char *)NULL); - exit(0); - /*NOTREACHED*/ - default: - while (waitpid(pid, &status, 0) != pid) - continue; - lseek(fd, (off_t)0, SEEK_SET); - st = read(fd, cp, TMP_BUFSIZ); - if (st > 0) { - len = (size_t)(el->el_line.lastchar - - el->el_line.buffer); - memset(&state, 0, sizeof(mbstate_t)); - len = mbsrtowcs(el->el_line.buffer, - (const char**) &cp, len, &state); - if (len > 0 && el->el_line.buffer[len -1] == '\n') - --len; - } - else - len = 0; - el->el_line.cursor = el->el_line.buffer; - el->el_line.lastchar = el->el_line.buffer + len; - el_free(cp); - el_free(line); - break; - } - - close(fd); - unlink(tempfile); - /* return CC_REFRESH; */ - return ed_newline(el, 0); - -/* XXXMYSQL: Avoid compiler warnings. */ -error: - close(fd); - unlink(tempfile); - return CC_ERROR; -} - -/* vi_history_word(): - * Vi append word from previous input line - * [_] - * Who knows where this one came from! - * '_' in vi means 'entire current line', so 'cc' is a synonym for 'c_' - */ -protected el_action_t -/*ARGSUSED*/ -vi_history_word(EditLine *el, Int c __attribute__((__unused__))) -{ - const Char *wp = HIST_FIRST(el); - const Char *wep, *wsp; - int len; - Char *cp; - const Char *lim; - - if (wp == NULL) - return CC_ERROR; - - wep = wsp = 0; - do { - while (Isspace(*wp)) - wp++; - if (*wp == 0) - break; - wsp = wp; - while (*wp && !Isspace(*wp)) - wp++; - wep = wp; - } while ((!el->el_state.doingarg || --el->el_state.argument > 0) - && *wp != 0); - - if (wsp == 0 || (el->el_state.doingarg && el->el_state.argument != 0)) - return CC_ERROR; - - cv_undo(el); - len = (int)(wep - wsp); - if (el->el_line.cursor < el->el_line.lastchar) - el->el_line.cursor++; - c_insert(el, len + 1); - cp = el->el_line.cursor; - lim = el->el_line.limit; - if (cp < lim) - *cp++ = ' '; - while (wsp < wep && cp < lim) - *cp++ = *wsp++; - el->el_line.cursor = cp; - - el->el_map.current = el->el_map.key; - return CC_REFRESH; -} - -/* vi_redo(): - * Vi redo last non-motion command - * [.] - */ -protected el_action_t -/*ARGSUSED*/ -vi_redo(EditLine *el, Int c __attribute__((__unused__))) -{ - c_redo_t *r = &el->el_chared.c_redo; - - if (!el->el_state.doingarg && r->count) { - el->el_state.doingarg = 1; - el->el_state.argument = r->count; - } - - el->el_chared.c_vcmd.pos = el->el_line.cursor; - el->el_chared.c_vcmd.action = r->action; - if (r->pos != r->buf) { - if (r->pos + 1 > r->lim) - /* sanity */ - r->pos = r->lim - 1; - r->pos[0] = 0; - FUN(el,push)(el, r->buf); - } - - el->el_state.thiscmd = r->cmd; - el->el_state.thisch = r->ch; - return (*el->el_map.func[r->cmd])(el, r->ch); -} diff --git a/config.h.cmake b/config.h.cmake index f7a5451c9a8..e0e19f37261 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -163,6 +163,7 @@ #cmakedefine HAVE_FSYNC 1 #cmakedefine HAVE_FTIME 1 #cmakedefine HAVE_GETADDRINFO 1 +#cmakedefine HAVE_GETIFADDRS 1 #cmakedefine HAVE_GETCWD 1 #cmakedefine HAVE_GETHOSTBYADDR_R 1 #cmakedefine HAVE_GETHRTIME 1 @@ -603,10 +604,6 @@ #cmakedefine WITH_CSV_STORAGE_ENGINE 1 #cmakedefine WITH_PARTITION_STORAGE_ENGINE 1 #cmakedefine WITH_PERFSCHEMA_STORAGE_ENGINE 1 -#cmakedefine WITH_NDBCLUSTER_STORAGE_ENGINE 1 -#if (WITH_NDBCLUSTER_STORAGE_ENGINE) && !defined(EMBEDDED_LIBRARY) -# define HAVE_NDB_BINLOG 1 -#endif #cmakedefine WITH_ARIA_STORAGE_ENGINE 1 #cmakedefine USE_ARIA_FOR_TMP_TABLES 1 @@ -642,6 +639,12 @@ #cmakedefine SIZEOF_TIME_T @SIZEOF_TIME_T@ #cmakedefine TIME_T_UNSIGNED @TIME_T_UNSIGNED@ +#ifndef EMBEDDED_LIBRARY +#cmakedefine WSREP_INTERFACE_VERSION "@WSREP_INTERFACE_VERSION@" +#cmakedefine WITH_WSREP 1 +#cmakedefine WSREP_PROC_INFO 1 +#endif + #ifdef _AIX /* AIX includes inttypes.h from sys/types.h diff --git a/configure.cmake b/configure.cmake index 7ec87f6e9a8..6997a3c3478 100644 --- a/configure.cmake +++ b/configure.cmake @@ -55,7 +55,7 @@ ENDIF() # Always enable -Wall for gnu C/C++ IF(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_FLAGS MATCHES ".*-Wall.*") - SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter") + SET(CMAKE_CXX_FLAGS "-Wall ${CMAKE_CXX_FLAGS} -Wall -Wno-unused-parameter -Wno-init-self") ENDIF() IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_FLAGS MATCHES ".*-Wall.*") SET(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS} -Wall") @@ -186,7 +186,6 @@ CHECK_INCLUDE_FILES (aio.h HAVE_AIO_H) CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H) CHECK_INCLUDE_FILES (crypt.h HAVE_CRYPT_H) CHECK_INCLUDE_FILE_CXX (cxxabi.h HAVE_CXXABI_H) -CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS) CHECK_INCLUDE_FILES (dirent.h HAVE_DIRENT_H) CHECK_INCLUDE_FILES (dlfcn.h HAVE_DLFCN_H) CHECK_INCLUDE_FILES (execinfo.h HAVE_EXECINFO_H) @@ -262,6 +261,8 @@ CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H) CHECK_INCLUDE_FILES (sys/sockio.h HAVE_SYS_SOCKIO_H) CHECK_INCLUDE_FILES (sys/utsname.h HAVE_SYS_UTSNAME_H) +SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DPACKAGE=test) # bfd.h is picky +CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS) IF(BFD_H_EXISTS) IF(NOT_FOR_DISTRIBUTION) SET(NON_DISTRIBUTABLE_WARNING 1) @@ -370,6 +371,7 @@ CHECK_FUNCTION_EXISTS (getpassphrase HAVE_GETPASSPHRASE) CHECK_FUNCTION_EXISTS (getpwnam HAVE_GETPWNAM) CHECK_FUNCTION_EXISTS (getpwuid HAVE_GETPWUID) CHECK_FUNCTION_EXISTS (getrlimit HAVE_GETRLIMIT) +CHECK_FUNCTION_EXISTS (getifaddrs HAVE_GETIFADDRS) CHECK_FUNCTION_EXISTS (getrusage HAVE_GETRUSAGE) CHECK_FUNCTION_EXISTS (getwd HAVE_GETWD) CHECK_FUNCTION_EXISTS (gmtime_r HAVE_GMTIME_R) diff --git a/debian/README.Maintainer b/debian/README.Maintainer index b1e0a602781..9e44495ee3b 100644 --- a/debian/README.Maintainer +++ b/debian/README.Maintainer @@ -45,9 +45,6 @@ debhelper (>=4.1.16): autoconf (>= 2.13-20), automake1.7 Try to get rid of them. -doxygen, tetex-bin, tetex-extra, gs - for ndb/docs/*tex - # # Remarks to the start scripts # diff --git a/debian/additions/my.cnf b/debian/additions/my.cnf index a27f8543f0b..1e0b97bf0b7 100644 --- a/debian/additions/my.cnf +++ b/debian/additions/my.cnf @@ -151,7 +151,21 @@ innodb_flush_method = O_DIRECT # ssl-cert=/etc/mysql/server-cert.pem # ssl-key=/etc/mysql/server-key.pem - +# +# * Galera-related settings +# +[galera] +# Mandatory settings +#wsrep_provider= +#wsrep_cluster_address= +#wsrep_slave_threads=1 +#binlog_format=row +#default_storage_engine=InnoDB +#innodb_autoinc_lock_mode=2 +#bind-address=0.0.0.0 +# +# Optional setting +#innodb_flush_log_at_trx_commit=0 [mysqldump] quick diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control index bbee264ffc3..4468917ca34 100644 --- a/debian/dist/Debian/control +++ b/debian/dist/Debian/control @@ -192,7 +192,11 @@ Architecture: any Suggests: tinyca, mailx, mariadb-test Recommends: libhtml-template-perl Pre-Depends: mariadb-common, adduser (>= 3.40), debconf -Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), mariadb-server-core-10.1 (>= ${binary:Version}) +Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl, + perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, + lsb-base (>= 3.0-10), mariadb-server-core-10.1 (>= ${binary:Version}), + galera (>=25.2), rsync, lsof, socat | netcat, grep, gawk, iproute, + coreutils, findutils Provides: mariadb-server, mysql-server, virtual-mysql-server Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}), mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5, diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control index ffcd1e5dca6..698b81eae00 100644 --- a/debian/dist/Ubuntu/control +++ b/debian/dist/Ubuntu/control @@ -186,7 +186,11 @@ Architecture: any Suggests: tinyca, mailx, mariadb-test Recommends: libhtml-template-perl Pre-Depends: mariadb-common, adduser (>= 3.40), debconf -Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), mariadb-server-core-10.1 (>= ${binary:Version}) +Depends: mariadb-client-10.1 (>= ${source:Version}), libdbi-perl, + perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, + lsb-base (>= 3.0-10), mariadb-server-core-10.1 (>= ${binary:Version}), + galera (>=25.2), rsync, lsof, socat | netcat, grep, gawk, iproute, + coreutils, findutils Provides: mariadb-server, mysql-server, virtual-mysql-server Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}), mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5, diff --git a/debian/libmariadbclient-dev.files b/debian/libmariadbclient-dev.files index 8f56a3065d5..a7595dceffd 100644 --- a/debian/libmariadbclient-dev.files +++ b/debian/libmariadbclient-dev.files @@ -4,4 +4,5 @@ usr/lib/libmysqlclient.a usr/lib/libmysqlclient_r.a usr/lib/libmysqlservices.a usr/share/aclocal/mysql.m4 +usr/share/pkgconfig/mariadb.pc usr/share/man/man1/mysql_config.1 diff --git a/debian/mariadb-server-10.1.mysql.init b/debian/mariadb-server-10.1.mysql.init index 7854007afc6..d1975bcbca7 100644 --- a/debian/mariadb-server-10.1.mysql.init +++ b/debian/mariadb-server-10.1.mysql.init @@ -108,7 +108,7 @@ case "${1:-''}" in # Start MariaDB! /usr/bin/mysqld_safe "${@:2}" > /dev/null 2>&1 & - # 6s was reported in #352070 to be too few when using ndbcluster + # 6s was reported in #352070 to be too little for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do sleep 1 if mysqld_status check_alive nowarn ; then break; fi diff --git a/debian/mariadb-server-10.1.preinst b/debian/mariadb-server-10.1.preinst index 49651c41195..1df01b2dcee 100644 --- a/debian/mariadb-server-10.1.preinst +++ b/debian/mariadb-server-10.1.preinst @@ -48,18 +48,6 @@ stop_server() { this_version=10.1 -# Abort if an NDB cluster is in use. -if egrep -qi -r '^[^#]*ndb.connectstring|^[[:space:]]*\[[[:space:]]*ndb_mgmd' /etc/mysql/; then - db_fset mysql-server/no_upgrade_when_using_ndb seen false || true - db_input high mysql-server/no_upgrade_when_using_ndb || true - db_go - db_stop - exit 1 -fi - -# Abort if skip-bdb option is enabled, required for 5.0 -> 5.1 upgrades. -#TODO - # Safe the user from stupidities. show_downgrade_warning=0 for i in `ls $DATADIR/debian-*.flag 2>/dev/null`; do diff --git a/debian/mariadb-server-10.1.templates b/debian/mariadb-server-10.1.templates index fd83d2af293..f64dd02d7bd 100644 --- a/debian/mariadb-server-10.1.templates +++ b/debian/mariadb-server-10.1.templates @@ -81,9 +81,3 @@ Type: error _Description: Password input error The two passwords you entered were not the same. Please try again. -Template: mysql-server/no_upgrade_when_using_ndb -Type: error -_Description: NDB Cluster seems to be in use - MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new - mysql-cluster package and remove all lines starting with "ndb" from - all config files below /etc/mysql/. diff --git a/debian/mariadb-test-10.1.dirs b/debian/mariadb-test-10.1.dirs index f45bf43f7e9..1a488d98195 100644 --- a/debian/mariadb-test-10.1.dirs +++ b/debian/mariadb-test-10.1.dirs @@ -19,9 +19,6 @@ usr/share/mysql/mysql-test/suite/parts usr/share/mysql/mysql-test/suite/parts/inc usr/share/mysql/mysql-test/suite/parts/t usr/share/mysql/mysql-test/suite/parts/r -usr/share/mysql/mysql-test/suite/rpl_ndb -usr/share/mysql/mysql-test/suite/rpl_ndb/t -usr/share/mysql/mysql-test/suite/rpl_ndb/r usr/share/mysql/mysql-test/suite/bugs usr/share/mysql/mysql-test/suite/bugs/t usr/share/mysql/mysql-test/suite/bugs/r @@ -46,9 +43,6 @@ usr/share/mysql/mysql-test/suite/jp/t usr/share/mysql/mysql-test/suite/jp/r usr/share/mysql/mysql-test/suite/jp/include usr/share/mysql/mysql-test/suite/jp/std_data -usr/share/mysql/mysql-test/suite/ndb -usr/share/mysql/mysql-test/suite/ndb/t -usr/share/mysql/mysql-test/suite/ndb/r usr/share/mysql/mysql-test/suite/maria usr/share/mysql/mysql-test/suite/maria/t usr/share/mysql/mysql-test/suite/maria/r @@ -63,9 +57,6 @@ usr/share/mysql/mysql-test/suite/binlog usr/share/mysql/mysql-test/suite/binlog/t usr/share/mysql/mysql-test/suite/binlog/r usr/share/mysql/mysql-test/suite/binlog/std_data -usr/share/mysql/mysql-test/suite/ndb_team -usr/share/mysql/mysql-test/suite/ndb_team/t -usr/share/mysql/mysql-test/suite/ndb_team/r usr/share/mysql/mysql-test/suite/federated usr/share/mysql/mysql-test/suite/funcs_1 usr/share/mysql/mysql-test/suite/funcs_1/cursors @@ -87,9 +78,5 @@ usr/share/mysql/mysql-test/suite/oqgraph/t usr/share/mysql/mysql-test/suite/oqgraph/r usr/share/mysql/mysql-test/suite/oqgraph/include usr/share/mysql/mysql-test/std_data -usr/share/mysql/mysql-test/std_data/ndb_backup50 usr/share/mysql/mysql-test/std_data/parts -usr/share/mysql/mysql-test/std_data/ndb_backup51_data_le -usr/share/mysql/mysql-test/std_data/ndb_backup51_data_be -usr/share/mysql/mysql-test/std_data/ndb_backup51 usr/share/mysql/mysql-test/std_data/funcs_1 diff --git a/debian/patches/00list b/debian/patches/00list index 77c159a17ed..1346748eba1 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -1,11 +1,10 @@ # 01_MAKEFILES__Docs_Images_Makefile.in.dpatch # 01_MAKEFILES__Docs_Makefile.in.dpatch -# 02_no_builtin_ndbcluster_plugin.dpatch # 21_init__openquery_configtest.dpatch 33_scripts__mysql_create_system_tables__no_test.dpatch 38_scripts__mysqld_safe.sh__signals.dpatch 41_scripts__mysql_install_db.sh__no_test.dpatch -44_scripts__mysql_config__libs.dpatch +# 44_scripts__mysql_config__libs.dpatch 50_mysql-test__db_test.dpatch # 60_zlib_innodb_workaround.dpatch 61_replace_dash_with_bash_mbug675185.dpatch diff --git a/debian/patches/02_no_builtin_ndbcluster_plugin.dpatch b/debian/patches/02_no_builtin_ndbcluster_plugin.dpatch deleted file mode 100644 index dc881ccca10..00000000000 --- a/debian/patches/02_no_builtin_ndbcluster_plugin.dpatch +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 02_no_builtin_ndbcluster_plugin.dpatch by -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: As we completely disabled ndbcluster - -@DPATCH@ - ---- old/sql/sql_builtin.cc -+++ new/sql/sql_builtin.cc -@@ -22,6 +22,6 @@ - - struct st_mysql_plugin *mysqld_builtins[]= - { -- builtin_binlog_plugin, builtin_partition_plugin, builtin_csv_plugin, builtin_heap_plugin, builtin_myisam_plugin, builtin_myisammrg_plugin, builtin_ndbcluster_plugin,(struct st_mysql_plugin *)0 -+ builtin_binlog_plugin, builtin_partition_plugin, builtin_csv_plugin, builtin_heap_plugin, builtin_myisam_plugin, builtin_myisammrg_plugin, (struct st_mysql_plugin *)0 - }; - diff --git a/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch b/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch index 7ce692a96b0..6547e4434f1 100755 --- a/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch +++ b/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch @@ -27,10 +27,10 @@ -- Fill "user" table with default users allowing root access -- from local machine if "user" table didn't exist before CREATE TEMPORARY TABLE tmp_user LIKE user; -@@ -43,8 +33,6 @@ INSERT INTO tmp_user VALUES ('localhost' - REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N' FROM dual WHERE @current_hostname != 'localhost'; - REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N'); - REPLACE INTO tmp_user VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N'); +@@ -43,8 +33,6 @@ INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y',' + REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0 FROM dual WHERE @current_hostname != 'localhost'; + REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0); + REPLACE INTO tmp_user VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0); -INSERT INTO tmp_user (host,user) VALUES ('localhost',''); -INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost'; INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; diff --git a/debian/po/ar.po b/debian/po/ar.po index 737522212b8..c9009069ee5 100644 --- a/debian/po/ar.po +++ b/debian/po/ar.po @@ -212,21 +212,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/ca.po b/debian/po/ca.po index bbff00407cc..7c7d2210834 100644 --- a/debian/po/ca.po +++ b/debian/po/ca.po @@ -177,21 +177,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #, fuzzy #~ msgid "" #~ "To use mysql you must install an equivalent user and group to the " diff --git a/debian/po/cs.po b/debian/po/cs.po index 7f80d45e33b..f3ae24b1e8c 100644 --- a/debian/po/cs.po +++ b/debian/po/cs.po @@ -214,21 +214,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/da.po b/debian/po/da.po index 8c592992182..d68b8575d72 100644 --- a/debian/po/da.po +++ b/debian/po/da.po @@ -216,21 +216,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/de.po b/debian/po/de.po index e1fbad09d67..6147b55903e 100644 --- a/debian/po/de.po +++ b/debian/po/de.po @@ -214,21 +214,3 @@ msgstr "" "Die beiden von Ihnen eingegebenen Passwörter sind nicht identisch. Bitte " "erneut versuchen." -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "NDB-Cluster scheint gerade benutzt zu werden" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" -"MySQL-5.1 bietet keine NDB-Clusterunterstützung mehr. Bitte migrieren Sie " -"Ihr System zum neuen »mysql-cluster«-Paket und entfernen Sie alle Zeilen, " -"die mit »ndb« beginnen aus allen Konfigurationsdateien im Verzeichnis /etc/" -"mysql/." diff --git a/debian/po/es.po b/debian/po/es.po index 957b40118bb..e76c173a9f5 100644 --- a/debian/po/es.po +++ b/debian/po/es.po @@ -244,21 +244,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/eu.po b/debian/po/eu.po index 0a4980488cb..8f1ae0c8ecd 100644 --- a/debian/po/eu.po +++ b/debian/po/eu.po @@ -206,29 +206,6 @@ msgstr "Pasahitz sarrera errorea" msgid "The two passwords you entered were not the same. Please try again." msgstr "Idatzi dituzun bi pasahitzak ez dira berdina. Mesedez saiatu berriz." -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "Dirudienez NDB Cluster-a erabilia dago" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -#, fuzzy -#| msgid "" -#| "MySQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " -#| "mysql-cluster package and remove all lines starting with \"ndb\" from all " -#| "config files below /etc/mysql/." -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" -"MySQL-5.1-ek NDB cluster euskarri umezurtz bat behar du. Mesedez migratu " -"mysql-cluster pakete berrira eta /etc/mysql/ azpiko konfigurazio fitxategi " -"guztietan \"ndb\"-ez hasten diren lerro guztiak ezabatu." - #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/fr.po b/debian/po/fr.po index 5055a354f9f..98d6740b7e2 100644 --- a/debian/po/fr.po +++ b/debian/po/fr.po @@ -202,24 +202,6 @@ msgstr "" "Le mot de passe et sa confirmation ne sont pas identiques. Veuillez " "recommencer." -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "Abandon de la gestion de NDB" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" -"La version 5.1 de MySQL ne gère plus les grappes NDB. Vous devriez utiliser " -"le paquet mysql-cluster et supprimer toutes les lignes commençant par " -"« ndb » des fichiers de configuration situés dans /etc/mysql." - #~ msgid "" #~ "To use MySQL, the following entries for users and groups should be added " #~ "to the system:" diff --git a/debian/po/gl.po b/debian/po/gl.po index d991d98053a..122e4091c16 100644 --- a/debian/po/gl.po +++ b/debian/po/gl.po @@ -208,21 +208,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/it.po b/debian/po/it.po index 40b24d575bf..459099cbc6a 100644 --- a/debian/po/it.po +++ b/debian/po/it.po @@ -199,20 +199,3 @@ msgstr "Errore di inserimento della password" msgid "The two passwords you entered were not the same. Please try again." msgstr "Le due password inserite sono diverse. Riprovare." -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "È in uso un cluster NDB" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" -"MySQL-5.1 non fornisce più il supporto per i cluster NDB. Si dovrebbe " -"migrare al nuovo pacchetto mysql-cluster e rimuovere tutte le righe che " -"iniziano per \"ndb\" da tutti i file di configurazione sotto /etc/mysql/." diff --git a/debian/po/ja.po b/debian/po/ja.po index 6173c9b1ef8..c1087266eaf 100644 --- a/debian/po/ja.po +++ b/debian/po/ja.po @@ -205,20 +205,3 @@ msgstr "パスワード入力エラー" msgid "The two passwords you entered were not the same. Please try again." msgstr "入力ã•れãŸäºŒã¤ã®ãƒ‘スワードãŒä¸€è‡´ã—ã¾ã›ã‚“。å†å…¥åŠ›ã—ã¦ãã ã•ã„。" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "NDB クラスタãŒåˆ©ç”¨ã•れã¦ã„るよã†ã§ã™" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" -"MySQL-5.1 ã§ã¯ NDB クラスタã®ã‚µãƒãƒ¼ãƒˆã‚’æä¾›ã—ãªããªã£ã¦ã„ã¾ã™ã€‚æ–°ãŸãª mysql-" -"cluster パッケージã«ç§»è¡Œã—ã¦ã€/etc/mysql 以下ã®è¨­å®šãƒ•ァイルã™ã¹ã¦ã‹ã‚‰ã€Œndbã€" -"ã§å§‹ã¾ã‚‹è¡Œã‚’削除ã—ã¦ãã ã•ã„。" diff --git a/debian/po/nb.po b/debian/po/nb.po index c3c2be245e7..992684fa3e1 100644 --- a/debian/po/nb.po +++ b/debian/po/nb.po @@ -222,21 +222,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" #~ msgstr "" diff --git a/debian/po/nl.po b/debian/po/nl.po index a8a920ffae8..82864ed8456 100644 --- a/debian/po/nl.po +++ b/debian/po/nl.po @@ -223,21 +223,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" #~ msgstr "" diff --git a/debian/po/pt.po b/debian/po/pt.po index 1cb1b455160..0c35c038b70 100644 --- a/debian/po/pt.po +++ b/debian/po/pt.po @@ -213,21 +213,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po index d8748ad9288..a0b4cdbfbfb 100644 --- a/debian/po/pt_BR.po +++ b/debian/po/pt_BR.po @@ -212,21 +212,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "To use MariaDB, the following entries for users and groups should be " #~ "added to the system:" diff --git a/debian/po/ro.po b/debian/po/ro.po index 0c37e3c0188..ceefecc8a1b 100644 --- a/debian/po/ro.po +++ b/debian/po/ro.po @@ -222,21 +222,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "Cannot upgrade if ISAM tables are present!" #~ msgstr "Nu se poate face actualizarea dacă sunt prezente tabele ISAM!" diff --git a/debian/po/ru.po b/debian/po/ru.po index 55d06fc86c9..5136933159b 100644 --- a/debian/po/ru.po +++ b/debian/po/ru.po @@ -206,20 +206,3 @@ msgstr "Ошибка ввода паролÑ" msgid "The two passwords you entered were not the same. Please try again." msgstr "Два введённых Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð½Ðµ одинаковы. Повторите ввод." -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "NDB Cluster уже иÑпользуетÑÑ" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" -"MySQL-5.1 больше не поддерживает NDB Cluster. Переходите на новый пакет " -"mysql-cluster и удалите вÑе Ñтроки, начинающиеÑÑ Ñ \"ndb\", из вÑех файлов " -"наÑтройки в каталоге /etc/mysql/." diff --git a/debian/po/sv.po b/debian/po/sv.po index 67d227618f4..0cd512a252b 100644 --- a/debian/po/sv.po +++ b/debian/po/sv.po @@ -200,24 +200,6 @@ msgstr "Fel vid inmatning av lösenord" msgid "The two passwords you entered were not the same. Please try again." msgstr "De tvÃ¥ lösenorden du angav stämde inte överrens. Prova igen." -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "NDB-kluster används inte" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" -"Stödet för NDB-kluster har tagits bort i MySQL-5.1. Migrera till det nya " -"paketet mysql-cluster och ta bort alla rader som inleds med \"ndb\" frÃ¥n " -"alla inställlningsfiler i /etc/mysql/." - #~ msgid "" #~ "To use MySQL, the following entries for users and groups should be added " #~ "to the system:" diff --git a/debian/po/templates.pot b/debian/po/templates.pot index 66af762ac0d..c164f1f4811 100644 --- a/debian/po/templates.pot +++ b/debian/po/templates.pot @@ -170,18 +170,3 @@ msgstr "" #: ../mariadb-server-10.1.templates:9001 msgid "The two passwords you entered were not the same. Please try again." msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" diff --git a/debian/po/tr.po b/debian/po/tr.po index 9e80ff89f00..814341a6bc2 100644 --- a/debian/po/tr.po +++ b/debian/po/tr.po @@ -178,21 +178,6 @@ msgstr "" msgid "The two passwords you entered were not the same. Please try again." msgstr "" -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "NDB Cluster seems to be in use" -msgstr "" - -#. Type: error -#. Description -#: ../mariadb-server-10.1.templates:10001 -msgid "" -"MySQL-5.1 no longer provides NDB Cluster support. Please migrate to the new " -"mysql-cluster package and remove all lines starting with \"ndb\" from all " -"config files below /etc/mysql/." -msgstr "" - #~ msgid "" #~ "To use mysql you must install an equivalent user and group to the " #~ "following and ensure yourself that /var/lib/mysql has the right " diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index 50db83f2777..b9e582004dc 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -13,15 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -INCLUDE_DIRECTORIES( -${CMAKE_SOURCE_DIR}/include -${ZLIB_INCLUDE_DIR} -# Following is for perror, in case NDB is compiled in. -${CMAKE_SOURCE_DIR}/storage/ndb/include -${CMAKE_SOURCE_DIR}/storage/ndb/include/util -${CMAKE_SOURCE_DIR}/storage/ndb/include/ndbapi -${CMAKE_SOURCE_DIR}/storage/ndb/include/portlib -${CMAKE_SOURCE_DIR}/storage/ndb/include/mgmapi) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${ZLIB_INCLUDE_DIR}) # Default install component for the files is Server here SET(MYSQL_INSTALL_COMPONENT Server) diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index e91163dde1c..bfd0c3c635a 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -98,6 +98,11 @@ static struct my_option my_long_options[] = {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; +void cleanup_and_exit(int exit_code) +{ + my_end(0); + exit(exit_code); +} static void usage(my_bool version) { @@ -112,7 +117,7 @@ static void usage(my_bool version) my_print_default_files(config_file); my_print_variables(my_long_options); printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); - exit(0); + cleanup_and_exit(0); } @@ -125,7 +130,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_defaults_file_used= 1; break; case 'n': - exit(0); + cleanup_and_exit(0); case 'I': case '?': usage(0); @@ -174,7 +179,7 @@ int main(int argc, char **argv) /* Check out the args */ if (get_options(&argc,&argv)) - exit(1); + cleanup_and_exit(1); nargs= argc + 1; if (opt_mysqld) diff --git a/extra/perror.c b/extra/perror.c index 8aa6aa35b08..11a703c8666 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -23,11 +23,6 @@ #include #include #include -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -#include "../storage/ndb/src/ndbapi/ndberror.c" -#include "../storage/ndb/src/kernel/error/ndbd_exit_codes.c" -#include "../storage/ndb/include/mgmapi/mgmapi_error.h" -#endif #include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ static my_bool verbose, print_all_codes; @@ -35,35 +30,12 @@ static my_bool verbose, print_all_codes; #include #include -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -static my_bool ndb_code; -static char ndb_string[1024]; -int mgmapi_error_string(int err_no, char *str, int size) -{ - int i; - for (i= 0; i < ndb_mgm_noOfErrorMsgs; i++) - { - if ((int)ndb_mgm_error_msgs[i].code == err_no) - { - my_snprintf(str, size-1, "%s", ndb_mgm_error_msgs[i].msg); - str[size-1]= '\0'; - return 0; - } - } - return -1; -} -#endif - static struct my_option my_long_options[] = { {"help", '?', "Displays this help and exits.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"info", 'I', "Synonym for --help.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE - {"ndb", 257, "Ndbcluster storage engine specific error codes.", &ndb_code, - &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. Deprecated," " will be removed in a future release.", @@ -334,35 +306,7 @@ int main(int argc,char *argv[]) found=0; code=atoi(*argv); -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE - if (ndb_code) - { - if ((ndb_error_string(code, ndb_string, sizeof(ndb_string)) < 0) && - (ndbd_exit_string(code, ndb_string, sizeof(ndb_string)) < 0) && - (mgmapi_error_string(code, ndb_string, sizeof(ndb_string)) < 0)) - { - msg= 0; - } - else - msg= ndb_string; - if (msg) - { - if (verbose) - printf("NDB error code %3d: %s\n",code,msg); - else - puts(msg); - } - else - { - fprintf(stderr,"Illegal ndb error code: %d\n",code); - error= 1; - } - found= 1; - msg= 0; - } - else -#endif - msg = strerror(code); + msg = strerror(code); /* We don't print the OS error message if it is the same as the diff --git a/cmd-line-utils/readline/CMakeLists.txt b/extra/readline/CMakeLists.txt similarity index 96% rename from cmd-line-utils/readline/CMakeLists.txt rename to extra/readline/CMakeLists.txt index c06b9c08c47..e245a2cd435 100644 --- a/cmd-line-utils/readline/CMakeLists.txt +++ b/extra/readline/CMakeLists.txt @@ -14,7 +14,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/cmd-line-utils) + ${CMAKE_SOURCE_DIR}/extra) ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR) diff --git a/cmd-line-utils/readline/COPYING b/extra/readline/COPYING similarity index 100% rename from cmd-line-utils/readline/COPYING rename to extra/readline/COPYING diff --git a/cmd-line-utils/readline/INSTALL b/extra/readline/INSTALL similarity index 100% rename from cmd-line-utils/readline/INSTALL rename to extra/readline/INSTALL diff --git a/cmd-line-utils/readline/README b/extra/readline/README similarity index 100% rename from cmd-line-utils/readline/README rename to extra/readline/README diff --git a/cmd-line-utils/readline/ansi_stdlib.h b/extra/readline/ansi_stdlib.h similarity index 100% rename from cmd-line-utils/readline/ansi_stdlib.h rename to extra/readline/ansi_stdlib.h diff --git a/cmd-line-utils/readline/bind.c b/extra/readline/bind.c similarity index 100% rename from cmd-line-utils/readline/bind.c rename to extra/readline/bind.c diff --git a/cmd-line-utils/readline/callback.c b/extra/readline/callback.c similarity index 100% rename from cmd-line-utils/readline/callback.c rename to extra/readline/callback.c diff --git a/cmd-line-utils/readline/chardefs.h b/extra/readline/chardefs.h similarity index 100% rename from cmd-line-utils/readline/chardefs.h rename to extra/readline/chardefs.h diff --git a/cmd-line-utils/readline/compat.c b/extra/readline/compat.c similarity index 100% rename from cmd-line-utils/readline/compat.c rename to extra/readline/compat.c diff --git a/cmd-line-utils/readline/complete.c b/extra/readline/complete.c similarity index 100% rename from cmd-line-utils/readline/complete.c rename to extra/readline/complete.c diff --git a/cmd-line-utils/readline/config_readline.h b/extra/readline/config_readline.h similarity index 100% rename from cmd-line-utils/readline/config_readline.h rename to extra/readline/config_readline.h diff --git a/cmd-line-utils/readline/configure.in b/extra/readline/configure.in similarity index 100% rename from cmd-line-utils/readline/configure.in rename to extra/readline/configure.in diff --git a/cmd-line-utils/readline/display.c b/extra/readline/display.c similarity index 100% rename from cmd-line-utils/readline/display.c rename to extra/readline/display.c diff --git a/cmd-line-utils/readline/emacs_keymap.c b/extra/readline/emacs_keymap.c similarity index 100% rename from cmd-line-utils/readline/emacs_keymap.c rename to extra/readline/emacs_keymap.c diff --git a/cmd-line-utils/readline/funmap.c b/extra/readline/funmap.c similarity index 100% rename from cmd-line-utils/readline/funmap.c rename to extra/readline/funmap.c diff --git a/cmd-line-utils/readline/histexpand.c b/extra/readline/histexpand.c similarity index 100% rename from cmd-line-utils/readline/histexpand.c rename to extra/readline/histexpand.c diff --git a/cmd-line-utils/readline/histfile.c b/extra/readline/histfile.c similarity index 100% rename from cmd-line-utils/readline/histfile.c rename to extra/readline/histfile.c diff --git a/cmd-line-utils/readline/histlib.h b/extra/readline/histlib.h similarity index 100% rename from cmd-line-utils/readline/histlib.h rename to extra/readline/histlib.h diff --git a/cmd-line-utils/readline/history.c b/extra/readline/history.c similarity index 100% rename from cmd-line-utils/readline/history.c rename to extra/readline/history.c diff --git a/cmd-line-utils/readline/history.h b/extra/readline/history.h similarity index 100% rename from cmd-line-utils/readline/history.h rename to extra/readline/history.h diff --git a/cmd-line-utils/readline/histsearch.c b/extra/readline/histsearch.c similarity index 100% rename from cmd-line-utils/readline/histsearch.c rename to extra/readline/histsearch.c diff --git a/cmd-line-utils/readline/input.c b/extra/readline/input.c similarity index 100% rename from cmd-line-utils/readline/input.c rename to extra/readline/input.c diff --git a/cmd-line-utils/readline/isearch.c b/extra/readline/isearch.c similarity index 100% rename from cmd-line-utils/readline/isearch.c rename to extra/readline/isearch.c diff --git a/cmd-line-utils/readline/keymaps.c b/extra/readline/keymaps.c similarity index 100% rename from cmd-line-utils/readline/keymaps.c rename to extra/readline/keymaps.c diff --git a/cmd-line-utils/readline/keymaps.h b/extra/readline/keymaps.h similarity index 100% rename from cmd-line-utils/readline/keymaps.h rename to extra/readline/keymaps.h diff --git a/cmd-line-utils/readline/kill.c b/extra/readline/kill.c similarity index 100% rename from cmd-line-utils/readline/kill.c rename to extra/readline/kill.c diff --git a/cmd-line-utils/readline/macro.c b/extra/readline/macro.c similarity index 100% rename from cmd-line-utils/readline/macro.c rename to extra/readline/macro.c diff --git a/cmd-line-utils/readline/mbutil.c b/extra/readline/mbutil.c similarity index 100% rename from cmd-line-utils/readline/mbutil.c rename to extra/readline/mbutil.c diff --git a/cmd-line-utils/readline/misc.c b/extra/readline/misc.c similarity index 100% rename from cmd-line-utils/readline/misc.c rename to extra/readline/misc.c diff --git a/cmd-line-utils/readline/nls.c b/extra/readline/nls.c similarity index 100% rename from cmd-line-utils/readline/nls.c rename to extra/readline/nls.c diff --git a/cmd-line-utils/readline/parens.c b/extra/readline/parens.c similarity index 100% rename from cmd-line-utils/readline/parens.c rename to extra/readline/parens.c diff --git a/cmd-line-utils/readline/posixdir.h b/extra/readline/posixdir.h similarity index 100% rename from cmd-line-utils/readline/posixdir.h rename to extra/readline/posixdir.h diff --git a/cmd-line-utils/readline/posixjmp.h b/extra/readline/posixjmp.h similarity index 100% rename from cmd-line-utils/readline/posixjmp.h rename to extra/readline/posixjmp.h diff --git a/cmd-line-utils/readline/posixstat.h b/extra/readline/posixstat.h similarity index 100% rename from cmd-line-utils/readline/posixstat.h rename to extra/readline/posixstat.h diff --git a/cmd-line-utils/readline/readline.c b/extra/readline/readline.c similarity index 100% rename from cmd-line-utils/readline/readline.c rename to extra/readline/readline.c diff --git a/cmd-line-utils/readline/readline.h b/extra/readline/readline.h similarity index 100% rename from cmd-line-utils/readline/readline.h rename to extra/readline/readline.h diff --git a/cmd-line-utils/readline/rlconf.h b/extra/readline/rlconf.h similarity index 100% rename from cmd-line-utils/readline/rlconf.h rename to extra/readline/rlconf.h diff --git a/cmd-line-utils/readline/rldefs.h b/extra/readline/rldefs.h similarity index 100% rename from cmd-line-utils/readline/rldefs.h rename to extra/readline/rldefs.h diff --git a/cmd-line-utils/readline/rlmbutil.h b/extra/readline/rlmbutil.h similarity index 100% rename from cmd-line-utils/readline/rlmbutil.h rename to extra/readline/rlmbutil.h diff --git a/cmd-line-utils/readline/rlprivate.h b/extra/readline/rlprivate.h similarity index 100% rename from cmd-line-utils/readline/rlprivate.h rename to extra/readline/rlprivate.h diff --git a/cmd-line-utils/readline/rlshell.h b/extra/readline/rlshell.h similarity index 100% rename from cmd-line-utils/readline/rlshell.h rename to extra/readline/rlshell.h diff --git a/cmd-line-utils/readline/rlstdc.h b/extra/readline/rlstdc.h similarity index 100% rename from cmd-line-utils/readline/rlstdc.h rename to extra/readline/rlstdc.h diff --git a/cmd-line-utils/readline/rltty.c b/extra/readline/rltty.c similarity index 100% rename from cmd-line-utils/readline/rltty.c rename to extra/readline/rltty.c diff --git a/cmd-line-utils/readline/rltty.h b/extra/readline/rltty.h similarity index 100% rename from cmd-line-utils/readline/rltty.h rename to extra/readline/rltty.h diff --git a/cmd-line-utils/readline/rltypedefs.h b/extra/readline/rltypedefs.h similarity index 100% rename from cmd-line-utils/readline/rltypedefs.h rename to extra/readline/rltypedefs.h diff --git a/cmd-line-utils/readline/rlwinsize.h b/extra/readline/rlwinsize.h similarity index 100% rename from cmd-line-utils/readline/rlwinsize.h rename to extra/readline/rlwinsize.h diff --git a/cmd-line-utils/readline/savestring.c b/extra/readline/savestring.c similarity index 100% rename from cmd-line-utils/readline/savestring.c rename to extra/readline/savestring.c diff --git a/cmd-line-utils/readline/search.c b/extra/readline/search.c similarity index 100% rename from cmd-line-utils/readline/search.c rename to extra/readline/search.c diff --git a/cmd-line-utils/readline/shell.c b/extra/readline/shell.c similarity index 100% rename from cmd-line-utils/readline/shell.c rename to extra/readline/shell.c diff --git a/cmd-line-utils/readline/signals.c b/extra/readline/signals.c similarity index 100% rename from cmd-line-utils/readline/signals.c rename to extra/readline/signals.c diff --git a/cmd-line-utils/readline/tcap.h b/extra/readline/tcap.h similarity index 100% rename from cmd-line-utils/readline/tcap.h rename to extra/readline/tcap.h diff --git a/cmd-line-utils/readline/terminal.c b/extra/readline/terminal.c similarity index 100% rename from cmd-line-utils/readline/terminal.c rename to extra/readline/terminal.c diff --git a/cmd-line-utils/readline/text.c b/extra/readline/text.c similarity index 100% rename from cmd-line-utils/readline/text.c rename to extra/readline/text.c diff --git a/cmd-line-utils/readline/tilde.c b/extra/readline/tilde.c similarity index 100% rename from cmd-line-utils/readline/tilde.c rename to extra/readline/tilde.c diff --git a/cmd-line-utils/readline/tilde.h b/extra/readline/tilde.h similarity index 100% rename from cmd-line-utils/readline/tilde.h rename to extra/readline/tilde.h diff --git a/cmd-line-utils/readline/undo.c b/extra/readline/undo.c similarity index 100% rename from cmd-line-utils/readline/undo.c rename to extra/readline/undo.c diff --git a/cmd-line-utils/readline/util.c b/extra/readline/util.c similarity index 100% rename from cmd-line-utils/readline/util.c rename to extra/readline/util.c diff --git a/cmd-line-utils/readline/vi_keymap.c b/extra/readline/vi_keymap.c similarity index 100% rename from cmd-line-utils/readline/vi_keymap.c rename to extra/readline/vi_keymap.c diff --git a/cmd-line-utils/readline/vi_mode.c b/extra/readline/vi_mode.c similarity index 100% rename from cmd-line-utils/readline/vi_mode.c rename to extra/readline/vi_mode.c diff --git a/cmd-line-utils/readline/xmalloc.c b/extra/readline/xmalloc.c similarity index 100% rename from cmd-line-utils/readline/xmalloc.c rename to extra/readline/xmalloc.c diff --git a/cmd-line-utils/readline/xmalloc.h b/extra/readline/xmalloc.h similarity index 100% rename from cmd-line-utils/readline/xmalloc.h rename to extra/readline/xmalloc.h diff --git a/include/m_string.h b/include/m_string.h index 395fd2ddda6..0a46805bfae 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -239,4 +239,15 @@ static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str) lex_str->length= strlen(c_str); } +#ifdef __cplusplus +static inline char *safe_str(char *str) +{ return str ? str : const_cast(""); } +#endif + +static inline const char *safe_str(const char *str) +{ return str ? str : ""; } + +static inline size_t safe_strlen(const char *str) +{ return str ? strlen(str) : 0; } + #endif diff --git a/include/maria.h b/include/maria.h index 908825b9970..b35dc7dd3f0 100644 --- a/include/maria.h +++ b/include/maria.h @@ -19,9 +19,6 @@ #ifndef _maria_h #define _maria_h -#ifdef __cplusplus -extern "C" { -#endif #include #include #include @@ -30,6 +27,10 @@ extern "C" { #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define MARIA_CANNOT_ROLLBACK /* diff --git a/include/my_base.h b/include/my_base.h index cdf8e189031..a443b4d161c 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -159,8 +159,6 @@ enum ha_extra_function { Ignore if the a tuple is not found, continue processing the transaction and ignore that 'row'. Needed for idempotency handling on the slave - - Currently only used by NDB storage engine. Partition handler ignores flag. */ HA_EXTRA_IGNORE_NO_KEY, HA_EXTRA_NO_IGNORE_NO_KEY, diff --git a/include/my_global.h b/include/my_global.h index e9a472e686e..4a1cc8c5b75 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -480,16 +480,14 @@ extern "C" int madvise(void *addr, size_t len, int behav); /* Suppress uninitialized variable warning without generating code. - - The _cplusplus is a temporary workaround for C++ code pending a fix - for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). */ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \ - defined(__cplusplus) || !defined(__GNUC__) -#define UNINIT_VAR(x) x= 0 -#else +#if defined(__GNUC__) /* GCC specific self-initialization which inhibits the warning. */ #define UNINIT_VAR(x) x= x +#elif defined(_lint) || defined(FORCE_INIT_OF_VARS) +#define UNINIT_VAR(x) x= 0 +#else +#define UNINIT_VAR(x) x #endif #if !defined(HAVE_UINT) @@ -1233,9 +1231,6 @@ static inline double rint(double x) #undef HAVE_SMEM /* No shared memory */ #else -#ifdef WITH_NDB_BINLOG -#define HAVE_NDB_BINLOG 1 -#endif #define HAVE_REPLICATION #define HAVE_EXTERNAL_CLIENT #endif /* EMBEDDED_LIBRARY */ diff --git a/include/my_md5.h b/include/my_md5.h index 77557fb9346..141ea309cae 100644 --- a/include/my_md5.h +++ b/include/my_md5.h @@ -28,7 +28,7 @@ extern "C" { #endif -void compute_md5_hash(char *digest, const char *buf, int len); +#define compute_md5_hash(A,B,C) my_md5(A,B,C) /* Convert an array of bytes to a hexadecimal representation. diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index ceb6ac93ff5..499f3589145 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID; #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104 /* MariaDB plugin interface version */ -#define MARIA_PLUGIN_INTERFACE_VERSION 0x0108 +#define MARIA_PLUGIN_INTERFACE_VERSION 0x010a /* The allowable types of plugins @@ -186,7 +186,7 @@ struct st_mysql_show_var { enum enum_mysql_show_type type; }; -#define SHOW_VAR_FUNC_BUFF_SIZE 1024 +#define SHOW_VAR_FUNC_BUFF_SIZE (256 * sizeof(void*)) typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *); diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 98fd089570d..ce456806fb8 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -112,9 +112,32 @@ void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t); extern struct my_sha1_service_st { void (*my_sha1_type)(unsigned char*, const char*, size_t); void (*my_sha1_multi_type)(unsigned char*, ...); + size_t (*my_sha1_context_size_type)(); + void (*my_sha1_init_type)(void *); + void (*my_sha1_input_type)(void *, const unsigned char *, size_t); + void (*my_sha1_result_type)(void *, unsigned char *); } *my_sha1_service; void my_sha1(unsigned char*, const char*, size_t); void my_sha1_multi(unsigned char*, ...); +size_t my_sha1_context_size(); +void my_sha1_init(void *context); +void my_sha1_input(void *context, const unsigned char *buf, size_t len); +void my_sha1_result(void *context, unsigned char *digest); +#include +extern struct my_md5_service_st { + void (*my_md5_type)(unsigned char*, const char*, size_t); + void (*my_md5_multi_type)(unsigned char*, ...); + size_t (*my_md5_context_size_type)(); + void (*my_md5_init_type)(void *); + void (*my_md5_input_type)(void *, const unsigned char *, size_t); + void (*my_md5_result_type)(void *, unsigned char *); +} *my_md5_service; +void my_md5(unsigned char*, const char*, size_t); +void my_md5_multi(unsigned char*, ...); +size_t my_md5_context_size(); +void my_md5_init(void *context); +void my_md5_input(void *context, const unsigned char *buf, size_t len); +void my_md5_result(void *context, unsigned char *digest); #include typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 6d52c5be7f0..fefbb06ab8c 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -112,9 +112,32 @@ void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t); extern struct my_sha1_service_st { void (*my_sha1_type)(unsigned char*, const char*, size_t); void (*my_sha1_multi_type)(unsigned char*, ...); + size_t (*my_sha1_context_size_type)(); + void (*my_sha1_init_type)(void *); + void (*my_sha1_input_type)(void *, const unsigned char *, size_t); + void (*my_sha1_result_type)(void *, unsigned char *); } *my_sha1_service; void my_sha1(unsigned char*, const char*, size_t); void my_sha1_multi(unsigned char*, ...); +size_t my_sha1_context_size(); +void my_sha1_init(void *context); +void my_sha1_input(void *context, const unsigned char *buf, size_t len); +void my_sha1_result(void *context, unsigned char *digest); +#include +extern struct my_md5_service_st { + void (*my_md5_type)(unsigned char*, const char*, size_t); + void (*my_md5_multi_type)(unsigned char*, ...); + size_t (*my_md5_context_size_type)(); + void (*my_md5_init_type)(void *); + void (*my_md5_input_type)(void *, const unsigned char *, size_t); + void (*my_md5_result_type)(void *, unsigned char *); +} *my_md5_service; +void my_md5(unsigned char*, const char*, size_t); +void my_md5_multi(unsigned char*, ...); +size_t my_md5_context_size(); +void my_md5_init(void *context); +void my_md5_input(void *context, const unsigned char *buf, size_t len); +void my_md5_result(void *context, unsigned char *digest); #include typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index cb3e7cafc97..0d28f6a00ff 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -112,9 +112,32 @@ void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t); extern struct my_sha1_service_st { void (*my_sha1_type)(unsigned char*, const char*, size_t); void (*my_sha1_multi_type)(unsigned char*, ...); + size_t (*my_sha1_context_size_type)(); + void (*my_sha1_init_type)(void *); + void (*my_sha1_input_type)(void *, const unsigned char *, size_t); + void (*my_sha1_result_type)(void *, unsigned char *); } *my_sha1_service; void my_sha1(unsigned char*, const char*, size_t); void my_sha1_multi(unsigned char*, ...); +size_t my_sha1_context_size(); +void my_sha1_init(void *context); +void my_sha1_input(void *context, const unsigned char *buf, size_t len); +void my_sha1_result(void *context, unsigned char *digest); +#include +extern struct my_md5_service_st { + void (*my_md5_type)(unsigned char*, const char*, size_t); + void (*my_md5_multi_type)(unsigned char*, ...); + size_t (*my_md5_context_size_type)(); + void (*my_md5_init_type)(void *); + void (*my_md5_input_type)(void *, const unsigned char *, size_t); + void (*my_md5_result_type)(void *, unsigned char *); +} *my_md5_service; +void my_md5(unsigned char*, const char*, size_t); +void my_md5_multi(unsigned char*, ...); +size_t my_md5_context_size(); +void my_md5_init(void *context); +void my_md5_input(void *context, const unsigned char *buf, size_t len); +void my_md5_result(void *context, unsigned char *digest); #include typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { diff --git a/include/mysql/service_logger.h b/include/mysql/service_logger.h index 962ab2fbc0b..d14b28da712 100644 --- a/include/mysql/service_logger.h +++ b/include/mysql/service_logger.h @@ -71,7 +71,7 @@ extern struct logger_service_st { int (*rotate)(LOGGER_HANDLE *log); } *logger_service; -#if MYSQL_DYNAMIC_PLUGIN +#ifdef MYSQL_DYNAMIC_PLUGIN #define logger_init_mutexes logger_service->logger_init_mutexes #define logger_open(path, size_limit, rotations) \ diff --git a/include/mysql/service_md5.h b/include/mysql/service_md5.h new file mode 100644 index 00000000000..5e589e57415 --- /dev/null +++ b/include/mysql/service_md5.h @@ -0,0 +1,69 @@ +#ifndef MYSQL_SERVICE_MD5_INCLUDED +/* Copyright (c) 2014, Monty Program Ab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + @file + my md5 service + + Functions to calculate MD5 hash from a memory buffer +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MYSQL_ABI_CHECK +#include +#endif + +#define MY_MD5_HASH_SIZE 16 /* Hash size in bytes */ + +extern struct my_md5_service_st { + void (*my_md5_type)(unsigned char*, const char*, size_t); + void (*my_md5_multi_type)(unsigned char*, ...); + size_t (*my_md5_context_size_type)(); + void (*my_md5_init_type)(void *); + void (*my_md5_input_type)(void *, const unsigned char *, size_t); + void (*my_md5_result_type)(void *, unsigned char *); +} *my_md5_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN + +#define my_md5(A,B,C) my_md5_service->my_md5_type(A,B,C) +#define my_md5_multi my_md5_service->my_md5_multi_type +#define my_md5_context_size() my_md5_service->my_md5_context_size_type() +#define my_md5_init(A) my_md5_service->my_md5_init_type(A) +#define my_md5_input(A,B,C) my_md5_service->my_md5_input_type(A,B,C) +#define my_md5_result(A,B) my_md5_service->my_md5_result_type(A,B) + +#else + +void my_md5(unsigned char*, const char*, size_t); +void my_md5_multi(unsigned char*, ...); +size_t my_md5_context_size(); +void my_md5_init(void *context); +void my_md5_input(void *context, const unsigned char *buf, size_t len); +void my_md5_result(void *context, unsigned char *digest); + +#endif + +#ifdef __cplusplus +} +#endif + +#define MYSQL_SERVICE_MD5_INCLUDED +#endif + diff --git a/include/mysql/service_sha1.h b/include/mysql/service_sha1.h index 01f5ba81566..609e173e8ce 100644 --- a/include/mysql/service_sha1.h +++ b/include/mysql/service_sha1.h @@ -1,5 +1,5 @@ #ifndef MYSQL_SERVICE_SHA1_INCLUDED -/* Copyright (c) 2013, Monty Program Ab +/* Copyright (c) 2013, 2014, Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,17 +34,29 @@ extern "C" { extern struct my_sha1_service_st { void (*my_sha1_type)(unsigned char*, const char*, size_t); void (*my_sha1_multi_type)(unsigned char*, ...); + size_t (*my_sha1_context_size_type)(); + void (*my_sha1_init_type)(void *); + void (*my_sha1_input_type)(void *, const unsigned char *, size_t); + void (*my_sha1_result_type)(void *, unsigned char *); } *my_sha1_service; #ifdef MYSQL_DYNAMIC_PLUGIN #define my_sha1(A,B,C) my_sha1_service->my_sha1_type(A,B,C) #define my_sha1_multi my_sha1_service->my_sha1_multi_type +#define my_sha1_context_size_type() my_sha1_service->my_sha1_context_size_type() +#define my_sha1_init_type(A) my_sha1_service->my_sha1_init_type(A) +#define my_sha1_input_type(A,B,C) my_sha1_service->my_sha1_input_type(A,B,C) +#define my_sha1_result_type(A,B) my_sha1_service->my_sha1_result_type(A,B) #else void my_sha1(unsigned char*, const char*, size_t); void my_sha1_multi(unsigned char*, ...); +size_t my_sha1_context_size(); +void my_sha1_init(void *context); +void my_sha1_input(void *context, const unsigned char *buf, size_t len); +void my_sha1_result(void *context, unsigned char *digest); #endif diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h new file mode 100644 index 00000000000..11872469cc7 --- /dev/null +++ b/include/mysql/service_wsrep.h @@ -0,0 +1,205 @@ +#ifndef MYSQL_SERVICE_WSREP_INCLUDED +/* Copyright (c) 2013, Monty Program Ab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + @file + wsrep service + + Interface to WSREP functionality in the server. + For engines that want to support galera. +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +enum wsrep_conflict_state { + NO_CONFLICT, + MUST_ABORT, + ABORTING, + ABORTED, + MUST_REPLAY, + REPLAYING, + RETRY_AUTOCOMMIT, + CERT_FAILURE, +}; + +enum wsrep_exec_mode { + LOCAL_STATE, + REPL_RECV, + TOTAL_ORDER, + LOCAL_COMMIT +}; + +enum wsrep_query_state { + QUERY_IDLE, + QUERY_EXEC, + QUERY_COMMITTING, + QUERY_EXITING, + QUERY_ROLLINGBACK, +}; + +enum wsrep_trx_status { + WSREP_TRX_OK, + WSREP_TRX_CERT_FAIL, /* certification failure, must abort */ + WSREP_TRX_SIZE_EXCEEDED, /* trx size exceeded */ + WSREP_TRX_ERROR, /* native mysql error */ +}; + +struct xid_t; +struct wsrep; +struct wsrep_ws_handle; +struct wsrep_buf; + +extern struct wsrep_service_st { + struct wsrep * (*get_wsrep_func)(); + my_bool (*get_wsrep_certify_nonPK_func)(); + my_bool (*get_wsrep_debug_func)(); + my_bool (*get_wsrep_drupal_282555_workaround_func)(); + my_bool (*get_wsrep_load_data_splitting_func)(); + my_bool (*get_wsrep_log_conflicts_func)(); + long (*get_wsrep_protocol_version_func)(); + my_bool (*wsrep_aborting_thd_contains_func)(THD *thd); + void (*wsrep_aborting_thd_enqueue_func)(THD *thd); + bool (*wsrep_consistency_check_func)(THD *thd); + int (*wsrep_is_wsrep_xid_func)(const struct xid_t *xid); + void (*wsrep_lock_rollback_func)(); + int (*wsrep_on_func)(MYSQL_THD); + void (*wsrep_post_commit_func)(THD* thd, bool all); + bool (*wsrep_prepare_key_func)(const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*); + enum wsrep_trx_status (*wsrep_run_wsrep_commit_func)(THD *thd, handlerton *hton, bool all); + void (*wsrep_thd_LOCK_func)(THD *thd); + void (*wsrep_thd_UNLOCK_func)(THD *thd); + void (*wsrep_thd_awake_func)(THD *thd, my_bool signal); + enum wsrep_conflict_state (*wsrep_thd_conflict_state_func)(MYSQL_THD, my_bool); + const char * (*wsrep_thd_conflict_state_str_func)(THD *thd); + enum wsrep_exec_mode (*wsrep_thd_exec_mode_func)(THD *thd); + const char * (*wsrep_thd_exec_mode_str_func)(THD *thd); + enum wsrep_conflict_state (*wsrep_thd_get_conflict_state_func)(MYSQL_THD); + my_bool (*wsrep_thd_is_BF_func)(MYSQL_THD , my_bool); + my_bool (*wsrep_thd_is_wsrep_func)(MYSQL_THD thd); + char * (*wsrep_thd_query_func)(THD *thd); + enum wsrep_query_state (*wsrep_thd_query_state_func)(THD *thd); + const char * (*wsrep_thd_query_state_str_func)(THD *thd); + int (*wsrep_thd_retry_counter_func)(THD *thd); + void (*wsrep_thd_set_conflict_state_func)(THD *thd, enum wsrep_conflict_state state); + long long (*wsrep_thd_trx_seqno_func)(THD *thd); + struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd); + int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd); + int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD); + void (*wsrep_unlock_rollback_func)(); +} *wsrep_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN +#define get_wsrep() wsrep_service->get_wsrep_func() +#define get_wsrep_certify_nonPK() wsrep_service->get_wsrep_certify_nonPK_func() +#define get_wsrep_debug() wsrep_service->get_wsrep_debug_func() +#define get_wsrep_drupal_282555_workaround() wsrep_service->get_wsrep_drupal_282555_workaround_func() +#define get_wsrep_load_data_splitting() wsrep_service->get_wsrep_load_data_splitting_func() +#define get_wsrep_log_conflicts() wsrep_service->get_wsrep_log_conflicts_func() +#define get_wsrep_protocol_version() wsrep_service->get_wsrep_protocol_version_func() +#define wsrep_aborting_thd_contains(T) wsrep_service->wsrep_aborting_thd_contains_func(T) +#define wsrep_aborting_thd_enqueue(T) wsrep_service->wsrep_aborting_thd_enqueue_func(T) +#define wsrep_consistency_check(T) wsrep_service->wsrep_consistency_check_func(T) +#define wsrep_is_wsrep_xid(X) wsrep_service->wsrep_is_wsrep_xid_func(X) +#define wsrep_lock_rollback() wsrep_service->wsrep_lock_rollback_func() +#define wsrep_on(X) wsrep_service->wsrep_on_func(X) +#define wsrep_post_commit(T,A) wsrep_service->wsrep_post_commit_func(T,A) +#define wsrep_prepare_key(A,B,C,D,E,F) wsrep_service->wsrep_prepare_key_func(A,B,C,D,E,F) +#define wsrep_run_wsrep_commit(T,H,A) wsrep_service->wsrep_run_wsrep_commit_func(T,H,A) +#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T) +#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T) +#define wsrep_thd_awake(T,S) wsrep_service->wsrep_thd_awake_func(T,S) +#define wsrep_thd_conflict_state(T,S) wsrep_service->wsrep_thd_conflict_state_func(T,S) +#define wsrep_thd_conflict_state_str(T) wsrep_service->wsrep_thd_conflict_state_str_func(T) +#define wsrep_thd_exec_mode(T) wsrep_service->wsrep_thd_exec_mode_func(T) +#define wsrep_thd_exec_mode_str(T) wsrep_service->wsrep_thd_exec_mode_str_func(T) +#define wsrep_thd_get_conflict_state(T) wsrep_service->wsrep_thd_get_conflict_state_func(T) +#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S) +#define wsrep_thd_is_wsrep(T) wsrep_service->wsrep_thd_is_wsrep_func(T) +#define wsrep_thd_query(T) wsrep_service->wsrep_thd_query_func(T) +#define wsrep_thd_query_state(T) wsrep_service->wsrep_thd_query_state_func(T) +#define wsrep_thd_query_state_str(T) wsrep_service->wsrep_thd_query_state_str_func(T) +#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T) +#define wsrep_thd_set_conflict_state(T,S) wsrep_service->wsrep_thd_set_conflict_state_func(T,S) +#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T) +#define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T) +#define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T) +#define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2) +#define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func() + +#define wsrep_debug get_wsrep_debug() +#define wsrep_log_conflicts get_wsrep_log_conflicts() +#define wsrep_certify_nonPK get_wsrep_certify_nonPK() +#define wsrep_load_data_splitting get_wsrep_load_data_splitting() +#define wsrep_drupal_282555_workaround get_wsrep_drupal_282555_workaround() +#define wsrep_protocol_version get_wsrep_protocol_version() + +#else + +extern my_bool wsrep_debug; +extern my_bool wsrep_log_conflicts; +extern my_bool wsrep_certify_nonPK; +extern my_bool wsrep_load_data_splitting; +extern my_bool wsrep_drupal_282555_workaround; +extern long wsrep_protocol_version; + +bool wsrep_consistency_check(THD *thd); +bool wsrep_prepare_key(const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len); +char *wsrep_thd_query(THD *thd); +const char *wsrep_thd_conflict_state_str(THD *thd); +const char *wsrep_thd_exec_mode_str(THD *thd); +const char *wsrep_thd_query_state_str(THD *thd); +enum wsrep_conflict_state wsrep_thd_conflict_state(MYSQL_THD thd, my_bool sync); +enum wsrep_conflict_state wsrep_thd_get_conflict_state(MYSQL_THD thd); +enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd); +enum wsrep_query_state wsrep_thd_query_state(THD *thd); +enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all); +int wsrep_is_wsrep_xid(const struct xid_t* xid); +int wsrep_on(MYSQL_THD thd); +int wsrep_thd_retry_counter(THD *thd); +int wsrep_trx_is_aborting(MYSQL_THD thd); +int wsrep_trx_order_before(MYSQL_THD thd1, MYSQL_THD thd2); +long get_wsrep_protocol_version(); +long long wsrep_thd_trx_seqno(THD *thd); +my_bool get_wsrep_certify_nonPK(); +my_bool get_wsrep_debug(); +my_bool get_wsrep_drupal_282555_workaround(); +my_bool get_wsrep_load_data_splitting(); +my_bool get_wsrep_log_conflicts(); +my_bool wsrep_aborting_thd_contains(THD *thd); +my_bool wsrep_thd_is_BF(MYSQL_THD thd, my_bool sync); +my_bool wsrep_thd_is_wsrep(MYSQL_THD thd); +struct wsrep *get_wsrep(); +struct wsrep_ws_handle *wsrep_thd_ws_handle(THD *thd); +void wsrep_aborting_thd_enqueue(THD *thd); +void wsrep_lock_rollback(); +void wsrep_post_commit(THD* thd, bool all); +void wsrep_thd_LOCK(THD *thd); +void wsrep_thd_UNLOCK(THD *thd); +void wsrep_thd_awake(THD *thd, my_bool signal); +void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state); +void wsrep_unlock_rollback(); + +#endif + +#ifdef __cplusplus +} +#endif + +#define MYSQL_SERVICE_WSREP_INCLUDED +#endif + diff --git a/include/mysql/services.h b/include/mysql/services.h index 62cac338703..4ff30fdd1bb 100644 --- a/include/mysql/services.h +++ b/include/mysql/services.h @@ -27,9 +27,11 @@ extern "C" { #include #include #include +#include #include #include #include +/*#include */ #ifdef __cplusplus } diff --git a/include/mysql_com.h b/include/mysql_com.h index f1e32003791..3a794b36c1e 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -186,11 +186,7 @@ enum enum_server_command #define REFRESH_USER_RESOURCES (1ULL << 19) #define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */ -#define REFRESH_TABLE_STATS (1ULL << 27) /* Refresh table stats hash table */ -#define REFRESH_INDEX_STATS (1ULL << 28) /* Refresh index stats hash table */ -#define REFRESH_USER_STATS (1ULL << 29) /* Refresh user stats hash table */ -#define REFRESH_CLIENT_STATS (1ULL << 30) /* Refresh client stats hash table */ - +#define REFRESH_GENERIC (1ULL << 30) #define REFRESH_FAST (1ULL << 31) /* Intern flag */ #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ diff --git a/include/mysqld_default_groups.h b/include/mysqld_default_groups.h index a2e94ddd854..3bc82359787 100644 --- a/include/mysqld_default_groups.h +++ b/include/mysqld_default_groups.h @@ -1,8 +1,8 @@ const char *load_default_groups[]= { -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -"mysql_cluster", -#endif "mysqld", "server", MYSQL_BASE_VERSION, "mariadb", MARIADB_BASE_VERSION, "client-server", +#ifdef WITH_WSREP +"galera", +#endif 0, 0}; diff --git a/include/service_versions.h b/include/service_versions.h index cca190b811c..da3a7edc012 100644 --- a/include/service_versions.h +++ b/include/service_versions.h @@ -28,7 +28,9 @@ #define VERSION_thd_wait 0x0100 #define VERSION_progress_report 0x0100 #define VERSION_thd_timezone 0x0100 -#define VERSION_my_sha1 0x0100 +#define VERSION_my_sha1 0x0101 +#define VERSION_my_md5 0x0100 +#define VERSION_wsrep 0x0100 #define VERSION_logger 0x0100 #define VERSION_thd_autoinc 0x0100 #define VERSION_thd_error_context 0x0100 diff --git a/include/thr_lock.h b/include/thr_lock.h index 3f7a5ca988f..2561709285f 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -20,7 +20,6 @@ #ifdef __cplusplus extern "C" { #endif - #include #include @@ -95,6 +94,7 @@ typedef struct st_thr_lock_info { pthread_t thread; my_thread_id thread_id; + void *mysql_thd; // THD pointer } THR_LOCK_INFO; @@ -164,6 +164,17 @@ my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data, ulong lock_wait_timeout); void thr_set_lock_wait_callback(void (*before_wait)(void), void (*after_wait)(void)); + +#ifdef WITH_WSREP +#include + typedef my_bool (* wsrep_thd_is_brute_force_fun)(void *, my_bool); + typedef int (* wsrep_abort_thd_fun)(void *, void *, my_bool); + typedef int (* wsrep_on_fun)(void *); + void wsrep_thr_lock_init( + wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun, + my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun); +#endif + #ifdef __cplusplus } #endif diff --git a/include/thr_timer.h b/include/thr_timer.h new file mode 100644 index 00000000000..724fdac41c8 --- /dev/null +++ b/include/thr_timer.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2014 Monty Program Ab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 or later of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* Prototypes when using thr_timer functions */ + +#ifndef THR_TIMER_INCLUDED +#define THR_TIMER_INCLUDED +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct st_timer { + struct timespec expire_time; + my_bool expired; + uint index_in_queue; + void (*func)(void*); + void *func_arg; +} thr_timer_t; + +/* Main functions for library */ +my_bool init_thr_timer(uint init_size_for_timer_queue); +void end_thr_timer(); + +/* Functions for handling one timer */ +void thr_timer_init(thr_timer_t *timer_data, void(*function)(void*), + void *arg); +my_bool thr_timer_settime(thr_timer_t *timer_data, ulonglong microseconds); +void thr_timer_end(thr_timer_t *timer_data); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* THR_TIMER_INCLUDED */ diff --git a/include/wsrep.h b/include/wsrep.h new file mode 100644 index 00000000000..a91f312d0a6 --- /dev/null +++ b/include/wsrep.h @@ -0,0 +1,51 @@ +/* Copyright 2014 Codership Oy & SkySQL Ab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include + +#ifndef WSREP_INCLUDED +#define WSREP_INCLUDED + +#ifdef WITH_WSREP +#define IF_WSREP(A,B) A +#define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A) + +#define WSREP_MYSQL_DB (char *)"mysql" +#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \ + if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \ + goto error; + +#define WSREP_TO_ISOLATION_END \ + if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \ + wsrep_to_isolation_end(thd); + +#define WSREP_DEBUG(...) \ + if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__) +#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__) +#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__) +#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__) + +#else +#define IF_WSREP(A,B) B +#define DBUG_ASSERT_IF_WSREP(A) +#define WSREP_DEBUG(...) +#define WSREP_INFO(...) +#define WSREP_WARN(...) +#define WSREP_ERROR(...) +#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) +#define WSREP_TO_ISOLATION_END +#endif + +#endif /* WSERP_INCLUDED */ diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 57a8fd830df..7dbc8cd70f5 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -106,6 +106,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/compat56.cc ../sql/table_cache.cc ../sql/item_inetfunc.cc + ../sql/wsrep_dummy.cc ${GEN_SOURCES} ${MYSYS_LIBWRAP_SOURCE} ) diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt index d70a98802f5..46be68a5b7f 100644 --- a/libservices/CMakeLists.txt +++ b/libservices/CMakeLists.txt @@ -25,6 +25,8 @@ SET(MYSQLSERVICES_SOURCES progress_report_service.c debug_sync_service.c my_sha1_service.c + my_md5_service.c + wsrep_service.c kill_statement_service.c logger_service.c) diff --git a/storage/ndb/src/cw/cpcc-win32/C++/TreeView.cpp b/libservices/my_md5_service.c similarity index 70% rename from storage/ndb/src/cw/cpcc-win32/C++/TreeView.cpp rename to libservices/my_md5_service.c index bcc7e67d06f..f993751a9a5 100644 --- a/storage/ndb/src/cw/cpcc-win32/C++/TreeView.cpp +++ b/libservices/my_md5_service.c @@ -1,5 +1,5 @@ -/* Copyright (c) 2003, 2005 MySQL AB - Use is subject to license terms +/* Copyright (c) 2014 Monty Program Ab + Use is subject to license terms. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "StdAfx.h" -#include "resource.h" -#include "CPC_GUI.h" +#include +SERVICE_VERSION my_md5_service= (void*)VERSION_my_md5; diff --git a/storage/ndb/include/ndb_net.h b/libservices/wsrep_service.c similarity index 71% rename from storage/ndb/include/ndb_net.h rename to libservices/wsrep_service.c index 357cf8f4671..5faf1a12d05 100644 --- a/storage/ndb/include/ndb_net.h +++ b/libservices/wsrep_service.c @@ -1,5 +1,4 @@ -/* Copyright (C) 2004 MySQL AB - Use is subject to license terms +/* Copyright (C) 2014 SkySQL Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,11 +11,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NDBNET_H -#define NDBNET_H +#include -#include +/* file reserved for the future use */ +SERVICE_VERSION wsrep_service= (void *) VERSION_wsrep; -#endif diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1 index 20abc250b15..87d640dead7 100644 --- a/man/mysql-test-run.pl.1 +++ b/man/mysql-test-run.pl.1 @@ -1141,25 +1141,6 @@ Section\ \&4.9, \(lqPassing Options from mysql-test-run.pl to mysqld or mysqltes .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: ndb-connectstring option -.\" ndb-connectstring option: mysql-test-run.pl -\fB\-\-ndb\-connectstring=\fR\fB\fIstr\fR\fR -.sp -Pass -\fB\-\-ndb\-connectstring=\fR\fB\fIstr\fR\fR -to the master MySQL server\&. This option also prevents -\fBmysql\-test\-run\&.pl\fR -from starting a cluster\&. It is assumed that there is already a cluster running to which the server can connect with the given connectstring\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} .\" mysql-test-run.pl: nocheck-testcases option .\" nocheck-testcases option: mysql-test-run.pl \fB\-\-nocheck\-testcases\fR @@ -1445,42 +1426,6 @@ Do not apply combinations; ignore combinations file or option\&. .sp -1 .IP \(bu 2.3 .\} -.\" mysql-test-run.pl: skip-ndbcluster option -.\" skip-ndbcluster option: mysql-test-run.pl -\fB\-\-skip\-ndbcluster\fR, -.\" mysql-test-run.pl: skip-ndb option -.\" skip-ndb option: mysql-test-run.pl -\fB\-\-skip\-ndb\fR -.sp -Do not start NDB Cluster; skip Cluster test cases\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysql-test-run.pl: skip-ndbcluster-slave option -.\" skip-ndbcluster-slave option: mysql-test-run.pl -\fB\-\-skip\-ndbcluster\-slave\fR, -.\" mysql-test-run.pl: skip-ndb-slave option -.\" skip-ndb-slave option: mysql-test-run.pl -\fB\-\-skip\-ndb\-slave\fR -.sp -Do not start an NDB Cluster slave\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} .\" mysql-test-run.pl: skip-rpl option .\" skip-rpl option: mysql-test-run.pl \fB\-\-skip\-rpl\fR @@ -2034,20 +1979,6 @@ Search the server log for errors or warning after each test and report any suspi .RE .sp .RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" mysql-test-run.pl: with-ndbcluster-only option -.\" with-ndbcluster-only option: mysql-test-run.pl -\fB\-\-with\-ndbcluster\-only\fR -.sp -Run only test cases that have -ndb -in their name\&. .RE .SH "COPYRIGHT" .br diff --git a/man/mysqldump.1 b/man/mysqldump.1 index 59d2416b25e..e91e8859ec4 100644 --- a/man/mysqldump.1 +++ b/man/mysqldump.1 @@ -1718,14 +1718,6 @@ option are mutually exclusive because LOCK TABLES causes any pending transactions to be committed implicitly\&. .sp -This option is not supported for MySQL Cluster tables; the results cannot be guaranteed to be consistent due to the fact that the -NDBCLUSTER -storage engine supports only the -READ_COMMITTED -transaction isolation level\&. You should always use -NDB -backup and restore instead\&. -.sp To dump large tables, you should combine the \fB\-\-single\-transaction\fR option with diff --git a/man/ndbd.8 b/man/ndbd.8 deleted file mode 100644 index c3c28d7491b..00000000000 --- a/man/ndbd.8 +++ /dev/null @@ -1,819 +0,0 @@ -'\" t -.\" Title: \fBndbd\fR -.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] -.\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/06/2010 -.\" Manual: MySQL Database System -.\" Source: MySQL 5.1 -.\" Language: English -.\" -.TH "\FBNDBD\FR" "8" "04/06/2010" "MySQL 5\&.1" "MySQL Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.\" ndbd -.\" MySQL Cluster: ndbd -.\" MySQL Cluster: data nodes -.\" data nodes (MySQL Cluster) -.\" storage nodes - see data nodes, ndbd -.SH "NAME" -ndbd \- the MySQL Cluster data node daemon -.SH "SYNOPSIS" -.HP \w'\fBndbd\ \fR\fB\fIoptions\fR\fR\ 'u -\fBndbd \fR\fB\fIoptions\fR\fR -.SH "DESCRIPTION" -.PP -\fBndbd\fR -is the process that is used to handle all the data in tables using the NDB Cluster storage engine\&. This is the process that empowers a data node to accomplish distributed transaction handling, node recovery, checkpointing to disk, online backup, and related tasks\&. -.PP -In a MySQL Cluster, a set of -\fBndbd\fR -processes cooperate in handling data\&. These processes can execute on the same computer (host) or on different computers\&. The correspondences between data nodes and Cluster hosts is completely configurable\&. -.\" MySQL Cluster: administration -.\" MySQL Cluster: commands -.\" command options (MySQL Cluster): ndbd -.\" MySQL Cluster: ndbd process -.PP -The following table includes command options specific to the MySQL Cluster data node program -\fBndbd\fR\&. Additional descriptions follow the table\&. For options common to all MySQL Cluster programs, see -Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.PP -All of these options also apply to the multi\-threaded version of this program \(em -\fBndbmtd\fR, which is available in MySQL Cluster NDB 7\&.0 \(em and you may substitute -\(lq\fBndbmtd\fR\(rq -for -\(lq\fBndbd\fR\(rq -wherever the latter occurs in this section\&. -.sp .5v -.RE -.PP -For options common to all -NDBCLUSTER -programs, see -Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&. -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-\-bind\-address\fR -.TS -allbox tab(:); -l l s -l l s -l l s -^ l l -^ l l. -T{ -\fBVersion Introduced\fR -T}:T{ -5\&.1\&.12 -T} -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-\-bind\-address=name -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -string -T} -:T{ -\fBDefault\fR -T}:T{ -T} -.TE -.sp 1 -Causes -\fBndbd\fR -to bind to a specific network interface (host name or IP address)\&. This option has no default value\&. -.sp -This option was added in MySQL 5\&.1\&.12\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fB\-\-daemon\fR, -\fB\-d\fR -.TS -allbox tab(:); -l l s -l l s -^ l l -^ l l. -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-\-daemon -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -boolean -T} -:T{ -\fBDefault\fR -T}:T{ -TRUE -T} -.TE -.sp 1 -Instructs -\fBndbd\fR -to execute as a daemon process\&. This is the default behavior\&. -\fB\-\-nodaemon\fR -can be used to prevent the process from running as a daemon\&. -.sp -This option has no effect when running -\fBndbd\fR -or -\fBndbmtd\fR -on Windows platforms\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" --initial option (ndbd) -.\" --initial option (ndbmtd) -\fB\-\-initial\fR -.TS -allbox tab(:); -l l s -l l s -^ l l -^ l l. -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-\-initial -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -boolean -T} -:T{ -\fBDefault\fR -T}:T{ -FALSE -T} -.TE -.sp 1 -Instructs -\fBndbd\fR -to perform an initial start\&. An initial start erases any files created for recovery purposes by earlier instances of -\fBndbd\fR\&. It also re\-creates recovery log files\&. Note that on some operating systems this process can take a substantial amount of time\&. -.sp -An -\fB\-\-initial\fR -start is to be used -\fIonly\fR -when starting the -\fBndbd\fR -process under very special circumstances; this is because this option causes all files to be removed from the Cluster file system and all redo log files to be re\-created\&. These circumstances are listed here: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -When performing a software upgrade which has changed the contents of any files\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -When restarting the node with a new version of -\fBndbd\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -As a measure of last resort when for some reason the node restart or system restart repeatedly fails\&. In this case, be aware that this node can no longer be used to restore data due to the destruction of the data files\&. -.RE -.RS 4 -Use of this option prevents the -StartPartialTimeout -and -StartPartitionedTimeout -configuration parameters from having any effect\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -This option does -\fInot\fR -affect either of the following: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Backup files that have already been created by the affected node -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -MySQL Cluster Disk Data files (see -Section\ \&17.5.10, \(lqMySQL Cluster Disk Data Tables\(rq)\&. -.RE -.RS 4 -.sp -This option also has no effect on recovery of data by a data node that is just starting (or restarting) from data nodes that are already running\&. This recovery of data occurs automatically, and requires no user intervention in a MySQL Cluster that is running normally\&. -.sp .5v -.RE -It is permissible to use this option when starting the cluster for the very first time (that is, before any data node files have been created); however, it is -\fInot\fR -necessary to do so\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" --initial-start option (ndbd) -.\" --initial-start option (ndbmtd) -\fB\-\-initial\-start\fR -.TS -allbox tab(:); -l l s -l l s -l l s -^ l l -^ l l. -T{ -\fBVersion Introduced\fR -T}:T{ -5\&.1\&.11 -T} -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-\-initial\-start -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -boolean -T} -:T{ -\fBDefault\fR -T}:T{ -FALSE -T} -.TE -.sp 1 -This option is used when performing a partial initial start of the cluster\&. Each node should be started with this option, as well as -\fB\-\-nowait\-nodes\fR\&. -.sp -Suppose that you have a 4\-node cluster whose data nodes have the IDs 2, 3, 4, and 5, and you wish to perform a partial initial start using only nodes 2, 4, and 5 \(em that is, omitting node 3: -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBndbd \-\-ndb\-nodeid=2 \-\-nowait\-nodes=3 \-\-initial\-start\fR -shell> \fBndbd \-\-ndb\-nodeid=4 \-\-nowait\-nodes=3 \-\-initial\-start\fR -shell> \fBndbd \-\-ndb\-nodeid=5 \-\-nowait\-nodes=3 \-\-initial\-start\fR -.fi -.if n \{\ -.RE -.\} -.sp -Prior to MySQL 5\&.1\&.19, it was not possible to perform DDL operations involving Disk Data tables on a partially started cluster\&. (See -\m[blue]\fBBug#24631\fR\m[]\&\s-2\u[1]\d\s+2\&.) -.sp -When using this option, you must also specify the node ID for the data node being started with the -\fB\-\-ndb\-nodeid\fR -option\&. -.sp -This option was added in MySQL 5\&.1\&.11\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -Do not confuse this option with the -\fB\-\-nowait\-nodes\fR -option added for -\fBndb_mgmd\fR -in MySQL Cluster NDB 7\&.0\&.10, which can be used to allow a cluster configured with multiple management servers to be started without all management servers being online\&. -.sp .5v -.RE -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" --nowait-nodes option (ndbd) -.\" --nowait-nodes option (ndbmtd) -\fB\-\-nowait\-nodes=\fR\fB\fInode_id_1\fR\fR\fB[, \fR\fB\fInode_id_2\fR\fR\fB[, \&.\&.\&.]]\fR -.TS -allbox tab(:); -l l s -l l s -l l s -^ l l -^ l l. -T{ -\fBVersion Introduced\fR -T}:T{ -5\&.1\&.9 -T} -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-\-nowait\-nodes=list -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -string -T} -:T{ -\fBDefault\fR -T}:T{ -T} -.TE -.sp 1 -This option takes a list of data nodes which for which the cluster will not wait for before starting\&. -.sp -This can be used to start the cluster in a partitioned state\&. For example, to start the cluster with only half of the data nodes (nodes 2, 3, 4, and 5) running in a 4\-node cluster, you can start each -\fBndbd\fR -process with -\fB\-\-nowait\-nodes=3,5\fR\&. In this case, the cluster starts as soon as nodes 2 and 4 connect, and does -\fInot\fR -wait -StartPartitionedTimeout -milliseconds for nodes 3 and 5 to connect as it would otherwise\&. -.sp -If you wanted to start up the same cluster as in the previous example without one -\fBndbd\fR -\(em say, for example, that the host machine for node 3 has suffered a hardware failure \(em then start nodes 2, 4, and 5 with -\fB\-\-nowait\-nodes=3\fR\&. Then the cluster will start as soon as nodes 2, 4, and 5 connect and will not wait for node 3 to start\&. -.sp -This option was added in MySQL 5\&.1\&.9\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" --nodaemon option (ndbd) -.\" --nodaemon option (ndbmtd) -\fB\-\-nodaemon\fR -.TS -allbox tab(:); -l l s -l l s -^ l l -^ l l -l l s -^ l l -^ l l. -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-\-nodaemon -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -boolean -T} -:T{ -\fBDefault\fR -T}:T{ -FALSE -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR (windows) -T}:T{ -boolean -T} -:T{ -\fBDefault\fR -T}:T{ -TRUE -T} -.TE -.sp 1 -Instructs -\fBndbd\fR -not to start as a daemon process\&. This is useful when -\fBndbd\fR -is being debugged and you want output to be redirected to the screen\&. -.sp -As of MySQL Cluster NDB 7\&.0\&.8, the default behavior for -\fBndbd\fR -and -\fBndbmtd\fR -on Windows is to run in the foreground, making this option unnecessary on Windows platforms\&. (\m[blue]\fBBug#45588\fR\m[]\&\s-2\u[2]\d\s+2) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" --nostart option (ndbd) -.\" -n option (ndbd) -.\" --nostart option (ndbmtd) -.\" -n option (ndbmtd) -\fB\-\-nostart\fR, -\fB\-n\fR -.TS -allbox tab(:); -l l s -l l s -^ l l -^ l l. -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-\-nostart -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -boolean -T} -:T{ -\fBDefault\fR -T}:T{ -FALSE -T} -.TE -.sp 1 -Instructs -\fBndbd\fR -not to start automatically\&. When this option is used, -\fBndbd\fR -connects to the management server, obtains configuration data from it, and initializes communication objects\&. However, it does not actually start the execution engine until specifically requested to do so by the management server\&. This can be accomplished by issuing the proper -START -command in the management client (see -Section\ \&17.5.2, \(lqCommands in the MySQL Cluster Management Client\(rq)\&. -.RE -.\" MySQL Cluster: log files -.\" log files (MySQL Cluster) -.PP -\fBndbd\fR -generates a set of log files which are placed in the directory specified by -DataDir -in the -config\&.ini -configuration file\&. -.PP -These log files are listed below\&. -\fInode_id\fR -is the node\'s unique identifier\&. Note that -\fInode_id\fR -represents the node\'s unique identifier\&. For example, -ndb_2_error\&.log -is the error log generated by the data node whose node ID is -2\&. -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" MySQL Cluster: error logs -.\" error logs (MySQL Cluster) -ndb_\fInode_id\fR_error\&.log -is a file containing records of all crashes which the referenced -\fBndbd\fR -process has encountered\&. Each record in this file contains a brief error string and a reference to a trace file for this crash\&. A typical entry in this file might appear as shown here: -.sp -.if n \{\ -.RS 4 -.\} -.nf -Date/Time: Saturday 30 July 2004 \- 00:20:01 -Type of error: error -Message: Internal program error (failed ndbrequire) -Fault ID: 2341 -Problem data: DbtupFixAlloc\&.cpp -Object of reference: DBTUP (Line: 173) -ProgramName: NDB Kernel -ProcessID: 14909 -TraceFile: ndb_2_trace\&.log\&.2 -***EOM*** -.fi -.if n \{\ -.RE -.\} -.sp -Listings of possible -\fBndbd\fR -exit codes and messages generated when a data node process shuts down prematurely can be found in -\m[blue]\fBndbd Error Messages\fR\m[]\&\s-2\u[3]\d\s+2\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBImportant\fR -.ps -1 -.br -\fIThe last entry in the error log file is not necessarily the newest one\fR -(nor is it likely to be)\&. Entries in the error log are -\fInot\fR -listed in chronological order; rather, they correspond to the order of the trace files as determined in the -ndb_\fInode_id\fR_trace\&.log\&.next -file (see below)\&. Error log entries are thus overwritten in a cyclical and not sequential fashion\&. -.sp .5v -.RE -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.\" MySQL Cluster: trace files -.\" trace files (MySQL Cluster) -ndb_\fInode_id\fR_trace\&.log\&.\fItrace_id\fR -is a trace file describing exactly what happened just before the error occurred\&. This information is useful for analysis by the MySQL Cluster development team\&. -.sp -It is possible to configure the number of these trace files that will be created before old files are overwritten\&. -\fItrace_id\fR -is a number which is incremented for each successive trace file\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -ndb_\fInode_id\fR_trace\&.log\&.next -is the file that keeps track of the next trace file number to be assigned\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -ndb_\fInode_id\fR_out\&.log -is a file containing any data output by the -\fBndbd\fR -process\&. This file is created only if -\fBndbd\fR -is started as a daemon, which is the default behavior\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -ndb_\fInode_id\fR\&.pid -is a file containing the process ID of the -\fBndbd\fR -process when started as a daemon\&. It also functions as a lock file to avoid the starting of nodes with the same identifier\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -ndb_\fInode_id\fR_signal\&.log -is a file used only in debug versions of -\fBndbd\fR, where it is possible to trace all incoming, outgoing, and internal messages with their data in the -\fBndbd\fR -process\&. -.RE -.PP -It is recommended not to use a directory mounted through NFS because in some environments this can cause problems whereby the lock on the -\&.pid -file remains in effect even after the process has terminated\&. -.PP -To start -\fBndbd\fR, it may also be necessary to specify the host name of the management server and the port on which it is listening\&. Optionally, one may also specify the node ID that the process is to use\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBndbd \-\-connect\-string="nodeid=2;host=ndb_mgmd\&.mysql\&.com:1186"\fR -.fi -.if n \{\ -.RE -.\} -.PP -See -Section\ \&17.3.2.3, \(lqThe MySQL Cluster Connectstring\(rq, for additional information about this issue\&. -\fBndbd\fR(8), describes other options for -\fBndbd\fR\&. -.PP -When -\fBndbd\fR -starts, it actually initiates two processes\&. The first of these is called the -\(lqangel process\(rq; its only job is to discover when the execution process has been completed, and then to restart the -\fBndbd\fR -process if it is configured to do so\&. Thus, if you attempt to kill -\fBndbd\fR -via the Unix -\fBkill\fR -command, it is necessary to kill both processes, beginning with the angel process\&. The preferred method of terminating an -\fBndbd\fR -process is to use the management client and stop the process from there\&. -.PP -The execution process uses one thread for reading, writing, and scanning data, as well as all other activities\&. This thread is implemented asynchronously so that it can easily handle thousands of concurrent actions\&. In addition, a watch\-dog thread supervises the execution thread to make sure that it does not hang in an endless loop\&. A pool of threads handles file I/O, with each thread able to handle one open file\&. Threads can also be used for transporter connections by the transporters in the -\fBndbd\fR -process\&. In a multi\-processor system performing a large number of operations (including updates), the -\fBndbd\fR -process can consume up to 2 CPUs if permitted to do so\&. -.PP -For a machine with many CPUs it is possible to use several -\fBndbd\fR -processes which belong to different node groups; however, such a configuration is still considered experimental and is not supported for MySQL 5\&.1 in a production setting\&. See -Section\ \&17.1.5, \(lqKnown Limitations of MySQL Cluster\(rq\&. -.SH "COPYRIGHT" -.br -.PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. -.PP -This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. -.PP -This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -.PP -You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. -.sp -.SH "NOTES" -.IP " 1." 4 -Bug#24631 -.RS 4 -\%http://bugs.mysql.com/bug.php?id=24631 -.RE -.IP " 2." 4 -Bug#45588 -.RS 4 -\%http://bugs.mysql.com/bug.php?id=45588 -.RE -.IP " 3." 4 -ndbd Error Messages -.RS 4 -\%http://dev.mysql.com/doc/ndbapi/en/ndbd-error-messages.html -.RE -.SH "SEE ALSO" -For more information, please refer to the MySQL Reference Manual, -which may already be installed locally and which is also available -online at http://dev.mysql.com/doc/. -.SH AUTHOR -Sun Microsystems, Inc. (http://www.mysql.com/). diff --git a/man/ndbd_redo_log_reader.1 b/man/ndbd_redo_log_reader.1 deleted file mode 100644 index f6a2326cab4..00000000000 --- a/man/ndbd_redo_log_reader.1 +++ /dev/null @@ -1,176 +0,0 @@ -'\" t -.\" Title: \fBndbd_redo_log_reader\fR -.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] -.\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/06/2010 -.\" Manual: MySQL Database System -.\" Source: MySQL 5.1 -.\" Language: English -.\" -.TH "\FBNDBD_REDO_LOG_REA" "1" "04/06/2010" "MySQL 5\&.1" "MySQL Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.\" ndbd_redo_log_reader -.SH "NAME" -ndbd_redo_log_reader \- check and print content of cluster redo log -.SH "SYNOPSIS" -.HP \w'\fBndbd_redo_log_reader\ \fR\fB\fIfile_name\fR\fR\fB\ [\fR\fB\fIoptions\fR\fR\fB]\fR\ 'u -\fBndbd_redo_log_reader \fR\fB\fIfile_name\fR\fR\fB [\fR\fB\fIoptions\fR\fR\fB]\fR -.SH "DESCRIPTION" -.PP -Reads a redo log file, checking it for errors, printing its contents in a human\-readable format, or both\&. -\fBndbd_redo_log_reader\fR -is intended for use primarily by MySQL developers and support personnel in debugging and diagnosing problems\&. -.PP -This utility was made available as part of default builds beginning with MySQL Cluster NDB 6\&.1\&.3\&. It remains under development, and its syntax and behavior are subject to change in future releases\&. For this reason, it should be considered experimental at this time\&. -.PP -The C++ source files for -\fBndbd_redo_log_reader\fR -can be found in the directory -/storage/ndb/src/kernel/blocks/dblqh/redoLogReader\&. -.PP -The following table includes options that are specific to the MySQL Cluster program -\fBndbd_redo_log_reader\fR\&. Additional descriptions follow the table\&. For options common to all MySQL Cluster programs, see -Section\ \&17.4.2, \(lqOptions Common to MySQL Cluster Programs\(rq\&. -.PP -\fBUsage\fR: -.sp -.if n \{\ -.RS 4 -.\} -.nf -ndbd_redo_log_reader \fIfile_name\fR [\fIoptions\fR] -.fi -.if n \{\ -.RE -.\} -.PP -\fIfile_name\fR -is the name of a cluster REDO log file\&. REDO log files are located in the numbered directories under the data node\'s data directory (DataDir); the path under this directory to the REDO log files matches the pattern -ndb_\fI#\fR_fs/D\fI#\fR/LCP/\fI#\fR/T\fI#\fRF\fI#\fR\&.Data\&. In each case, the -\fI#\fR -represents a number (not necessarily the same number)\&. For more information, see -\m[blue]\fBCluster Data Node FileSystemDir Files\fR\m[]\&\s-2\u[1]\d\s+2\&. -.PP -The name of the file to be read may be followed by one or more of the options listed here: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.TS -allbox tab(:); -l l s -l l s -^ l l -^ l l. -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-noprint -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -boolean -T} -:T{ -\fBDefault\fR -T}:T{ -FALSE -T} -.TE -.sp 1 -\fB\-noprint\fR: Do not print the contents of the log file\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -.TS -allbox tab(:); -l l s -l l s -^ l l -^ l l. -T{ -\fBCommand\-Line Format\fR -T}:T{ -\-nocheck -T} -T{ -\ \& -T}:T{ -\fBPermitted Values \fR -T} -:T{ -\fBType\fR -T}:T{ -boolean -T} -:T{ -\fBDefault\fR -T}:T{ -FALSE -T} -.TE -.sp 1 -\fB\-nocheck\fR: Do not check the log file for errors\&. -.RE -.sp -.RE -.PP -Like -\fBndb_print_backup_file\fR -and -\fBndb_print_schema_file\fR -(and unlike most of the -NDB -utilities that are intended to be run on a management server host or to connect to a management server) -\fBndbd_redo_log_reader\fR -must be run on a cluster data node, since it accesses the data node file system directly\&. Because it does not make use of the management server, this utility can be used when the management server is not running, and even when the cluster has been completely shut down\&. -.SH "COPYRIGHT" -.br -.PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. -.PP -This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. -.PP -This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -.PP -You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. -.sp -.SH "NOTES" -.IP " 1." 4 -Cluster Data Node FileSystemDir Files -.RS 4 -\%http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndbd-filesystemdir-files.html -.RE -.SH "SEE ALSO" -For more information, please refer to the MySQL Reference Manual, -which may already be installed locally and which is also available -online at http://dev.mysql.com/doc/. -.SH AUTHOR -Sun Microsystems, Inc. (http://www.mysql.com/). diff --git a/man/ndbmtd.8 b/man/ndbmtd.8 deleted file mode 100644 index baadd4eaee2..00000000000 --- a/man/ndbmtd.8 +++ /dev/null @@ -1,388 +0,0 @@ -'\" t -.\" Title: \fBndbmtd\fR -.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] -.\" Generator: DocBook XSL Stylesheets v1.75.2 -.\" Date: 04/06/2010 -.\" Manual: MySQL Database System -.\" Source: MySQL 5.1 -.\" Language: English -.\" -.TH "\FBNDBMTD\FR" "8" "04/06/2010" "MySQL 5\&.1" "MySQL Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.\" ndbmtd -.\" MySQL Cluster: ndbmtd -.\" MySQL Cluster: data nodes -.\" data nodes (MySQL Cluster) -.\" storage nodes - see data nodes, ndbd, ndbmtd -.SH "NAME" -ndbmtd \- the MySQL Cluster data node daemon (multi\-threaded version) -.SH "SYNOPSIS" -.HP \w'\fBndbmtd\ \fR\fB\fIoptions\fR\fR\ 'u -\fBndbmtd \fR\fB\fIoptions\fR\fR -.SH "DESCRIPTION" -.PP -\fBndbmtd\fR -is a multi\-threaded version of -\fBndbd\fR, the process that is used to handle all the data in tables using the -NDBCLUSTER -storage engine\&. -\fBndbmtd\fR -is intended for use on host computers having multiple CPU cores\&. Except where otherwise noted, -\fBndbmtd\fR -functions in the same way as -\fBndbd\fR; therefore, in this section, we concentrate on the ways in which -\fBndbmtd\fR -differs from -\fBndbd\fR, and you should consult -\fBndbd\fR(8), for additional information about running MySQL Cluster data nodes that apply to both the single\-threaded and multi\-threaded versions of the data node process\&. -.PP -Command\-line options and configuration parameters used with -\fBndbd\fR -also apply to -\fBndbmtd\fR\&. For more information about these options and parameters, see -\fBndbd\fR(8), and -Section\ \&17.3.2.6, \(lqDefining MySQL Cluster Data Nodes\(rq, respectively\&. -.PP -\fBndbmtd\fR -is also file system\-compatible with -\fBndbd\fR\&. In other words, a data node running -\fBndbd\fR -can be stopped, the binary replaced with -\fBndbmtd\fR, and then restarted without any loss of data\&. (However, when doing this, you must make sure that -MaxNoOfExecutionThreads -is set to an apppriate value before restarting the node if you wish for -\fBndbmtd\fR -to run in multi\-threaded fashion\&.) Similarly, an -\fBndbmtd\fR -binary can be replaced with -\fBndbd\fR -simply by stopping the node and then starting -\fBndbd\fR -in place of the multi\-threaded binary\&. It is not necessary when switching between the two to start the data node binary using -\fB\-\-initial\fR\&. -.PP -Prior to MySQL Cluster NDB 7\&.0\&.6, there were known issues when using -\fBndbmtd\fR -with MySQL Cluster Disk Data tables\&. If you wish to use multi\-threaded data nodes with disk\-based -NDB -tables, you should ensure that you are running MySQL Cluster NDB 7\&.0\&.6 or later\&. (\m[blue]\fBBug#41915\fR\m[]\&\s-2\u[1]\d\s+2, -\m[blue]\fBBug#44915\fR\m[]\&\s-2\u[2]\d\s+2) -.PP -Using -\fBndbmtd\fR -differs from using -\fBndbd\fR -in two key respects: -.sp -.RS 4 -.ie n \{\ -\h'-04' 1.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 1." 4.2 -.\} -You must set an appropriate value for the -MaxNoOfExecutionThreads -configuration parameter in the -config\&.ini -file\&. If you do not do so, -\fBndbmtd\fR -runs in single\-threaded mode \(em that is, it behaves like -\fBndbd\fR\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 2.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 2." 4.2 -.\} -Trace files are generated by critical errors in -\fBndbmtd\fR -processes in a somewhat different fashion from how these are generated by -\fBndbd\fR -failures\&. -.RE -.PP -These differences are discussed in more detail in the next few paragraphs\&. -.\" execution threads (MySQL Cluster) -.\" MySQL Cluster: execution threads -.\" ndbmtd: MaxNoOfExecutionThreads -.\" MaxNoOfExecutionThreads: ndbmtd -.\" ndbmtd: trace files -.\" trace files: ndbmtd -.PP -\fBNumber of execution threads\fR. The -MaxNoOfExecutionThreads -configuration parameter is used to determine the number of local query handler (LQH) threads spawned by -\fBndbmtd\fR\&. Although this parameter is set in -[ndbd] -or -[ndbd default] -sections of the -config\&.ini -file, it is exclusive to -\fBndbmtd\fR -and does not apply to -\fBndbd\fR\&. -.PP -This parameter takes an integer value from 2 to 8 inclusive\&. Generally, you should set this parameter equal to the number of CPU cores on the data node host, as shown in the following table: -.TS -allbox tab(:); -lB lB. -T{ -Number of Cores -T}:T{ -Recommended MaxNoOfExecutionThreads Value -T} -.T& -l l -l l -l l. -T{ -2 -T}:T{ -2 -T} -T{ -4 -T}:T{ -4 -T} -T{ -8 or more -T}:T{ -8 -T} -.TE -.sp 1 -.PP -(It is possible to set this parameter to other values within the permitted range, but these are automatically rounded as shown in the -\fBValue Used\fR -column of the next table in this section\&.) -.PP -The multi\-threaded data node process always spawns at least 4 threads: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -1 local query handler (LQH) thread -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -1 transaction coordinator (TC) thread -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -1 transporter thread -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -1 subscription manager (SUMA) thread -.RE -.PP -Setting this parameter to a value between 4 and 8 inclusive causes additional LQH threads to be used by -\fBndbmtd\fR -(up to a maximum of 4 LQH threads), as shown in the following table: -.TS -allbox tab(:); -lB lB lB. -T{ -config\&.ini Value -T}:T{ -Value Used -T}:T{ -Number of LQH Threads Used -T} -.T& -l l l -l l l -l l l. -T{ -3 -T}:T{ -2 -T}:T{ -1 -T} -T{ -5 or 6 -T}:T{ -4 -T}:T{ -2 -T} -T{ -7 -T}:T{ -8 -T}:T{ -4 -T} -.TE -.sp 1 -.PP -Setting this parameter outside the permitted range of values causes the management server to abort on startup with the error -Error line \fInumber\fR: Illegal value \fIvalue\fR for parameter MaxNoOfExecutionThreads\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.PP -In MySQL Cluster NDB 6\&.4\&.0, it is not possible to set -MaxNoOfExecutionThreads -to 2\&. You can safely use the value 3 instead (it is treated as 2 internally)\&. This issue is resolved in MySQL Cluster NDB 6\&.4\&.1\&. -.sp .5v -.RE -.PP -In MySQL Cluster NDB 6\&.4\&.0 through 6\&.4\&.3, the default value for this parameter was undefined, although the default behavior for -\fBndbmtd\fR -was to use 1 LQH thread, as though -MaxNoOfExecutionThreads -had been set to 2\&. Beginning with MySQL Cluster NDB 7\&.0\&.4, this parameter has an explcit default value of 2, thus guaranteeing this default behavior\&. -.PP -In MySQL Cluster NDB 7\&.0, it is not possible to cause -\fBndbmtd\fR -to use more than 1 TC thread, although we plan to introduce this capability in a future MySQL Cluster release series\&. -.\" MySQL Cluster: log files -.\" log files (MySQL Cluster): ndbmtd -.\" ndbmtd: trace files -.PP -Like -\fBndbd\fR, -\fBndbmtd\fR -generates a set of log files which are placed in the directory specified by -DataDir -in the -config\&.ini -configuration file\&. Except for trace files, these are generated in the same way and have the same names as those generated by -\fBndbd\fR\&. -.PP -In the event of a critical error, -\fBndbmtd\fR -generates trace files describing what happened just prior to the error\' occurrence\&. These files, which can be found in the data node\'s -DataDir, are useful for analysis of problems by the MySQL Cluster Development and Support teams\&. One trace file is generated for each -\fBndbmtd\fR -thread\&. The names of these files follow the pattern -ndb_\fInode_id\fR_trace\&.log\&.\fItrace_id\fR_t\fIthread_id\fR, where -\fInode_id\fR -is the data node\'s unique node ID in the cluster, -\fItrace_id\fR -is a trace sequence number, and -\fIthread_id\fR -is the thread ID\&. For example, in the event of the failure of an -\fBndbmtd\fR -process running as a MySQL Cluster data node having the node ID 3 and with -MaxNoOfExecutionThreads -equal to 4, four trace files are generated in the data node\'s data directory; if the is the first time this node has failed, then these files are named -ndb_3_trace\&.log\&.1_t1, -ndb_3_trace\&.log\&.1_t2, -ndb_3_trace\&.log\&.1_t3, and -ndb_3_trace\&.log\&.1_t4\&. Internally, these trace files follow the same format as -\fBndbd\fR -trace files\&. -.PP -The -\fBndbd\fR -exit codes and messages that are generated when a data node process shuts down prematurely are also used by -\fBndbmtd\fR\&. See -\m[blue]\fBndbd Error Messages\fR\m[]\&\s-2\u[3]\d\s+2, for a listing of these\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.PP -It is possible to use -\fBndbd\fR -and -\fBndbmtd\fR -concurrently on different data nodes in the same MySQL Cluster\&. However, such configurations have not been tested extensively; thus, we cannot not recommend doing so in a production setting at this time\&. -.sp .5v -.RE -.SH "COPYRIGHT" -.br -.PP -Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. -.PP -This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. -.PP -This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -.PP -You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. -.sp -.SH "NOTES" -.IP " 1." 4 -Bug#41915 -.RS 4 -\%http://bugs.mysql.com/bug.php?id=41915 -.RE -.IP " 2." 4 -Bug#44915 -.RS 4 -\%http://bugs.mysql.com/bug.php?id=44915 -.RE -.IP " 3." 4 -ndbd Error Messages -.RS 4 -\%http://dev.mysql.com/doc/ndbapi/en/ndbd-error-messages.html -.RE -.SH "SEE ALSO" -For more information, please refer to the MySQL Reference Manual, -which may already be installed locally and which is also available -online at http://dev.mysql.com/doc/. -.SH AUTHOR -Sun Microsystems, Inc. (http://www.mysql.com/). diff --git a/man/perror.1 b/man/perror.1 index a37cec6a518..adf393e8057 100644 --- a/man/perror.1 +++ b/man/perror.1 @@ -77,22 +77,6 @@ OS error code 64: Machine is not on the network .RE .\} .PP -To obtain the error message for a MySQL Cluster error code, invoke -\fBperror\fR -with the -\fB\-\-ndb\fR -option: -.sp -.if n \{\ -.RS 4 -.\} -.nf -shell> \fBperror \-\-ndb \fR\fB\fIerrorcode\fR\fR -.fi -.if n \{\ -.RE -.\} -.PP Note that the meaning of system error messages may be dependent on your operating system\&. A given error code may mean different things on different operating systems\&. .PP \fBperror\fR @@ -124,21 +108,6 @@ Display a help message and exit\&. .sp -1 .IP \(bu 2.3 .\} -.\" perror: ndb option -.\" ndb option: perror -\fB\-\-ndb\fR -.sp -Print the error message for a MySQL Cluster error code\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} .\" perror: silent option .\" silent option: perror \fB\-\-silent\fR, diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index 2948fb88069..fe681758bd0 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -74,7 +74,7 @@ ENDIF() IF(WITH_EMBEDDED_SERVER) SET(TEST_EMBEDDED ${MTR_FORCE} --comment=embedded --timer --embedded-server - --skip-rpl --skip-ndbcluster ${EXP}) + --skip-rpl ${EXP}) ELSE() SET(TEST_EMBEDDED echo "Can not test embedded, not compiled in") ENDIF() @@ -92,8 +92,8 @@ ADD_CUSTOM_TARGET(test-force ADD_CUSTOM_TARGET(test-bt ${TEST_BT_START} - COMMAND ${MTR_FORCE} --comment=normal --timer --skip-ndbcluster --report-features ${EXP} - COMMAND ${MTR_FORCE} --comment=ps --timer --skip-ndbcluster --ps-protocol ${EXP} + COMMAND ${MTR_FORCE} --comment=normal --timer --report-features ${EXP} + COMMAND ${MTR_FORCE} --comment=ps --timer --ps-protocol ${EXP} COMMAND ${MTR_FORCE} --comment=funcs1+ps --ps-protocol --reorder --suite=funcs_1 ${EXP} COMMAND ${MTR_FORCE} --comment=funcs2 --suite=funcs_2 ${EXP} COMMAND ${MTR_FORCE} --comment=partitions --suite=parts ${EXP} @@ -105,13 +105,13 @@ ADD_CUSTOM_TARGET(test-bt ADD_CUSTOM_TARGET(test-bt-fast ${TEST_BT_START} - COMMAND ${MTR_FORCE} --comment=ps --timer --skip-ndbcluster --ps-protocol --report-features ${EXP} + COMMAND ${MTR_FORCE} --comment=ps --timer --ps-protocol --report-features ${EXP} COMMAND ${MTR_FORCE} --comment=stress --suite=stress ${EXP} ) ADD_CUSTOM_TARGET(test-bt-debug ${TEST_BT_START} - COMMAND ${MTR_FORCE} --comment=debug --timer --skip-ndbcluster --skip-rpl --report-features ${EXP} + COMMAND ${MTR_FORCE} --comment=debug --timer --skip-rpl --report-features ${EXP} ) # Process .in files with includes in collections/ diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 18cd4748687..cc2e86d6eda 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -1,7 +1,7 @@ # For easier human reading (MTR doesn't care), please keep entries # in alphabetical order. This also helps with merge conflict resolution. -binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin +binlog.binlog_multi_engine # joro : tests marked as experimental as agreed with bochklin funcs_1.charset_collation_1 # depends on compile-time decisions diff --git a/mysql-test/collections/mysql-trunk.daily b/mysql-test/collections/mysql-trunk.daily index 47d189a2c65..9654d61be06 100644 --- a/mysql-test/collections/mysql-trunk.daily +++ b/mysql-test/collections/mysql-trunk.daily @@ -2,6 +2,5 @@ perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collection perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 -perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_ndb_row --vardir=var-rpl_ndb_row --mysqld=--binlog-format=row --suite=rpl_ndb,ndb -perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-ndb +perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_checksum --mysqld=--binlog-checksum=CRC32 --vardir=var-rpl_binlog_checksum --suite=binlog,rpl diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index ce5dde97894..831c6c886d5 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -372,7 +372,8 @@ dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA== SELECT * FROM t1; --echo # Their values should be ON -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; +SHOW SESSION VARIABLES LIKE "unique_checks"; --echo SET @@SESSION.foreign_key_checks= OFF; @@ -387,7 +388,8 @@ dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== SELECT * FROM t1; --echo # Their values should be OFF -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; +SHOW SESSION VARIABLES LIKE "unique_checks"; --echo # INSERT INTO t1 VALUES(2) --echo # foreign_key_checks=1 and unique_checks=1 @@ -401,7 +403,8 @@ dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== SELECT * FROM t1; --echo # Their values should be OFF -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; +SHOW SESSION VARIABLES LIKE "unique_checks"; DROP TABLE t1; diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test index 8cd86de8040..67286c37258 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test @@ -1,7 +1,6 @@ # # Test of auto_increment with offset # --- source include/not_ndb_default.inc -- source include/master-slave.inc eval create table t1 (a int not null auto_increment,b int, primary key (a)) engine=$engine_type2 auto_increment=3; diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test index 8c35ff974d8..34897d00733 100644 --- a/mysql-test/extra/rpl_tests/rpl_ddl.test +++ b/mysql-test/extra/rpl_tests/rpl_ddl.test @@ -146,13 +146,10 @@ eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type; # Prevent Bug#26687 rpl_ddl test fails if run with --innodb option # The testscript (suite/rpl/rpl_ddl.test) + the expected result need that the # slave uses MyISAM for the table mysqltest.t1. -# This is not valid in case of suite/rpl_ndb/rpl_ndb_ddl.test which sources -# also this script. sync_slave_with_master; connection slave; if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES - WHERE TABLE_SCHEMA = 'mysqltest1' AND TABLE_NAME = 't1' - AND ENGINE <> 'MyISAM' AND '$engine_type' <> 'NDB'`) + WHERE TABLE_SCHEMA = 'mysqltest1' AND TABLE_NAME = 't1' AND ENGINE <> 'MyISAM'`) { skip This test needs on slave side: InnoDB disabled, default engine: MyISAM; } diff --git a/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test index 7dcb9e2725c..9b5a552c327 100644 --- a/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test @@ -395,9 +395,6 @@ sync_slave_with_master; ############################################################### # Error reaction is up to sql_mode of the slave sql (bug#38173) #--echo *** Create t9 on slave *** -# Please, check BUG#47741 to see why you are not testing NDB. -if (`SELECT UPPER(LEFT($engine_type, 3)) != 'NDB'`) -{ STOP SLAVE; RESET SLAVE; eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), @@ -446,8 +443,6 @@ if (`SELECT UPPER(LEFT($engine_type, 3)) != 'NDB'`) DROP TABLE t9; sync_slave_with_master; -} - ############################################ # More columns in slave at middle of table # # Expect: Proper error message # diff --git a/mysql-test/extra/rpl_tests/rpl_foreign_key.test b/mysql-test/extra/rpl_tests/rpl_foreign_key.test index db646a736f9..d10deece1b1 100644 --- a/mysql-test/extra/rpl_tests/rpl_foreign_key.test +++ b/mysql-test/extra/rpl_tests/rpl_foreign_key.test @@ -21,9 +21,7 @@ connection master; SET TIMESTAMP=1000000000; CREATE TABLE t3 ( a INT UNIQUE ); SET FOREIGN_KEY_CHECKS=0; -# Had to add 1022 for run with ndb as ndb uses different -# error and error code for error ER_DUP_ENTRY. Bug 16677 ---error 1022, ER_DUP_ENTRY +--error ER_DUP_ENTRY INSERT INTO t3 VALUES (1),(1); sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test index 549d184185d..4be2ea376d2 100644 --- a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test +++ b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test @@ -64,22 +64,6 @@ while ($ddl_cases >= 1) { let $commit_event_row_number= 4; } - # - # In NDB (RBR and MIXED modes), the commit event is usually the seventh event - # in the binary log: - # - # 1: COMMAND - # 2: BEGIN - # 3: TABLE MAP EVENT - # 4: TABLE MAP EVENT (ndb_apply_status) - # 5: ROW EVENT - # 6: ROW EVENT - # 7: COMMIT - # - if ($engine == NDB) - { - let $commit_event_row_number= 7; - } let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1); --enable_query_log @@ -87,32 +71,10 @@ while ($ddl_cases >= 1) if ($ddl_cases == 41) { let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; - if ($engine == NDB) - { - # This seems to be related to epochs. - # We need to check this against an updated version or avoid it. - let $ok= no; - let $commit_event_row_number= 6; - } } if ($ddl_cases == 40) { let $cmd= LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES; - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 39) { @@ -121,21 +83,6 @@ while ($ddl_cases >= 1) if ($ddl_cases == 38) { let $cmd= CHECK TABLE nt_1; - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 37) { @@ -148,40 +95,10 @@ while ($ddl_cases >= 1) if ($ddl_cases == 35) { let $cmd= LOCK TABLES tt_1 WRITE; - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 34) { let $cmd= UNLOCK TABLES; - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 33) { @@ -194,42 +111,6 @@ while ($ddl_cases >= 1) if ($ddl_cases == 31) { let $cmd= SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass'); - # - # In NDB (RBR mode), the commit event is the eleventh event - # in the binary log: - # - # 1: DDL EVENT which triggered the previous commmit. - # 2: BEGIN - # 3: TABLE MAP EVENT - # 4: ROW EVENT - # 5: COMMIT - # 6: BEGIN - # 7: TABLE MAP EVENT - # 8: TABLE MAP EVENT (ndb_apply_status) - # 9: ROW EVENT - # 10: ROW EVENT - # 11: COMMIT - # - if (`SELECT '$engine' = 'NDB' && @@binlog_format = 'ROW'`) - { - let $commit_event_row_number= 11; - } - # - # In NDB (MIXED mode), the commit event is the eighth event - # in the binary log: - # - # 1: DDL EVENT which triggered the previous commmit. - # 2: BEGIN - # 3: TABLE MAP EVENT - # 4: TABLE MAP EVENT (ndb_apply_status) - # 5: ROW EVENT - # 6: ROW EVENT - # 7: COMMIT - # - if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'`) - { - let $commit_event_row_number= 7; - } } if ($ddl_cases == 30) { @@ -272,7 +153,7 @@ while ($ddl_cases >= 1) # 5: COMMIT # 6: DDL EVENT which triggered the previous commmit. # - if (`select @@binlog_format = 'ROW' && '$engine' != 'NDB'`) + if (`select @@binlog_format = 'ROW'`) { let $commit_event_row_number= 5; } @@ -316,42 +197,10 @@ while ($ddl_cases >= 1) if ($ddl_cases == 13) { let $cmd= CREATE INDEX ix ON tt_1(ddl_case); - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # 7: DDL EVENT which triggered the previous commmit. - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 12) { let $cmd= DROP INDEX ix ON tt_1; - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # 7: DDL EVENT which triggered the previous commmit. - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 11) { @@ -377,39 +226,6 @@ while ($ddl_cases >= 1) { let $commit_event_row_number= 4; } - # - # In NDB (RBR mode), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # - if (`SELECT '$engine' = 'NDB' && @@binlog_format = 'ROW'` ) - { - let $commit_event_row_number= 6; - } - # - # In NDB (MIXED mode), the commit event is the nineth event - # in the binary log: - # - # 1: BEGIN - # 2: DDL EVENT which triggered the previous commmit. - # 3: COMMIT - # 4: BEGIN - # 5: TABLE MAP EVENT - # 6: TABLE MAP EVENT (ndb_apply_status) - # 7: ROW EVENT - # 8: ROW EVENT - # 9: COMMIT - # - if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'` ) - { - let $commit_event_row_number= 9; - } } if ($ddl_cases == 10) { @@ -427,21 +243,6 @@ while ($ddl_cases >= 1) { let $commit_event_row_number= 4; } - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 9) { @@ -459,21 +260,6 @@ while ($ddl_cases >= 1) { let $commit_event_row_number= 4; } - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 8) { @@ -514,42 +300,6 @@ while ($ddl_cases >= 1) { let $commit_event_row_number= 5; } - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: DROP TEMPORARY table IF EXISTS - # 3: COMMIT - # 4: BEGIN - # 5: TABLE MAP EVENT - # 6: TABLE MAP EVENT (ndb_apply_status) - # 7: ROW EVENT - # 8: ROW EVENT - # 9: COMMIT - # - if ($engine == NDB) - { - let $commit_event_row_number= 9; - } - # - # In NDB (MIXED mode), the commit event is the nineth event - # in the binary log: - # - # 1: BEGIN - # 2: DDL EVENT which triggered the previous commmit. - # 3: COMMIT - # 4: BEGIN - # 5: TABLE MAP EVENT - # 6: TABLE MAP EVENT (ndb_apply_status) - # 7: ROW EVENT - # 8: ROW EVENT - # 9: COMMIT - # - if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'` ) - { - let $commit_event_row_number= 9; - } } if ($ddl_cases == 7) { @@ -574,42 +324,10 @@ while ($ddl_cases >= 1) if ($ddl_cases == 2) { let $cmd= CREATE DATABASE db; - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # 7: DDL EVENT which triggered the previous commmit. - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } if ($ddl_cases == 1) { let $cmd= DROP DATABASE IF EXISTS db; - # - # In NDB (RBR and MIXED modes), the commit event is the sixth event - # in the binary log: - # - # 1: BEGIN - # 2: TABLE MAP EVENT - # 3: TABLE MAP EVENT (ndb_apply_status) - # 4: ROW EVENT - # 5: ROW EVENT - # 6: COMMIT - # 7: DDL EVENT which triggered the previous commmit. - # - if ($engine == NDB) - { - let $commit_event_row_number= 6; - } } --eval $cmd --disable_query_log diff --git a/mysql-test/extra/rpl_tests/rpl_innodb.test b/mysql-test/extra/rpl_tests/rpl_innodb.test index 865c97cf95d..6b3732439b2 100644 --- a/mysql-test/extra/rpl_tests/rpl_innodb.test +++ b/mysql-test/extra/rpl_tests/rpl_innodb.test @@ -48,8 +48,6 @@ connection master; # #Note Matthias: to be merged to rpl_ddl.test ---source include/not_ndb_default.inc - FLUSH LOGS; sync_slave_with_master; FLUSH LOGS; diff --git a/mysql-test/extra/rpl_tests/rpl_loadfile.test b/mysql-test/extra/rpl_tests/rpl_loadfile.test index 85620b58a97..9073e5e3d9f 100644 --- a/mysql-test/extra/rpl_tests/rpl_loadfile.test +++ b/mysql-test/extra/rpl_tests/rpl_loadfile.test @@ -23,10 +23,6 @@ SELECT * FROM test.t1 ORDER BY blob_column; save_master_pos; sync_slave_with_master; connection slave; -# Need to allow some time when NDB engine is used for -# the injector thread to have time to populate binlog -let $wait_condition= SELECT INSTR(blob_column,'aberration') > 0 FROM test.t1 WHERE a = 2; ---source include/wait_condition.inc SELECT * FROM test.t1 ORDER BY blob_column; # Cleanup diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test index 991e1c465e9..32e035702da 100644 --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test @@ -12,8 +12,7 @@ # used in the same transaction. # # * Statements that do an implicit commit (i.e., most but not all DDL, and -# some utility commands) are logged specially due to unspecified requirements by -# NDB. +# some utility commands) are logged specially # # * Statements that update temporary tables need special treatment since they # are not logged in row format. @@ -147,9 +146,7 @@ # - Rules for committing statements, except CREATE [TEMPORARY] TABLE...SELECT # # * All other statements that have a pre-commit are written directly to the -# binlog. (Note: this is semantically equivalent to writing it to the SC and -# flushing the SC. However, due to requirements by NDB (which have not been -# clarified), we write directly to the binlog.) +# binlog. # # We use the include file rpl_mixing_engines.inc to generate sql commands from a # format string. The format string consists of a sequence of 'codes' separated diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_2multi_basic.test b/mysql-test/extra/rpl_tests/rpl_ndb_2multi_basic.test deleted file mode 100644 index 16f8116d92e..00000000000 --- a/mysql-test/extra/rpl_tests/rpl_ndb_2multi_basic.test +++ /dev/null @@ -1,119 +0,0 @@ -####################################### -# Author: Rafal Somla # -# Date: 2006-08-20 # -# Purpose: Test replication of basic # -# table operations in various setups # -# # -# Based on rpl_ndb_2multi_eng.test by # -# JBM # -####################################### - ---echo --- Doing pre test cleanup --- - -connection master; ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_query_log - -################################################# ---echo --- Create Table Section --- - -CREATE TABLE t1 (id MEDIUMINT NOT NULL, - b1 INT, - vc VARCHAR(255), - bc CHAR(255), - d DECIMAL(10,4) DEFAULT 0, - f FLOAT DEFAULT 0, - total BIGINT UNSIGNED, - y YEAR, - t DATE, - PRIMARY KEY(id)); - ---echo --- Show table on master --- - -SHOW CREATE TABLE t1; - ---echo --- Show table on slave --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---source include/rpl_multi_engine2.inc - -################################################# -# Okay lets see how it holds up to table changes ---echo --- Check that simple Alter statements are replicated correctly -- - -ALTER TABLE t1 DROP PRIMARY KEY; -# note: table with no PK can't contain blobs if it is to be replicated. -ALTER TABLE t1 MODIFY vc char(32); - ---echo --- Show the new improved table on the master --- - -SHOW CREATE TABLE t1; - ---echo --- Make sure that our tables on slave are still same engine --- ---echo --- and that the alter statements replicated correctly --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---source include/rpl_multi_engine2.inc - -################################################# ---echo --- Check that replication works when slave has more columns than master -connection master; -ALTER TABLE t1 ADD PRIMARY KEY(id,total); -ALTER TABLE t1 MODIFY vc TEXT; - -INSERT INTO t1 VALUES(3,1,'Testing MySQL databases is a cool ', - 'Must make it bug free for the customer', - 654321.4321,15.21,0,1965,"1905-11-14"); -INSERT INTO t1 VALUES(20,1,'Testing MySQL databases is a cool ', - 'Must make it bug free for the customer', - 654321.4321,15.21,0,1965,"1965-11-14"); -INSERT INTO t1 VALUES(50,1,'Testing MySQL databases is a cool ', - 'Must make it bug free for the customer', - 654321.4321,15.21,0,1965,"1985-11-14"); - ---echo --- Add columns on slave --- ---sync_slave_with_master -ALTER TABLE t1 ADD (u int, v char(16) default 'default'); -UPDATE t1 SET u=7 WHERE id < 50; -UPDATE t1 SET v='explicit' WHERE id >10; - ---echo --- Show changed table on slave --- - -SHOW CREATE TABLE t1; -SELECT * -FROM t1 -ORDER BY id; - ---source include/rpl_multi_engine2.inc -TRUNCATE TABLE t1; - -################################################# ---echo --- Check that replication works when master has more columns than slave -connection master; - ---echo --- Remove columns on slave --- ---sync_slave_with_master -ALTER TABLE t1 DROP COLUMN v; -ALTER TABLE t1 DROP COLUMN u; -ALTER TABLE t1 DROP COLUMN t; -ALTER TABLE t1 DROP COLUMN y; - ---echo --- Show changed table on slave --- - -SHOW CREATE TABLE t1; - ---source include/rpl_multi_engine2.inc -TRUNCATE TABLE t1; - -################################################# ---echo --- Do Cleanup -- -connection master; -DROP TABLE IF EXISTS t1; - -sync_slave_with_master; -connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test b/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test deleted file mode 100644 index 1677aaf8277..00000000000 --- a/mysql-test/extra/rpl_tests/rpl_ndb_2multi_eng.test +++ /dev/null @@ -1,347 +0,0 @@ -####################################### -# Author: JBM # -# Date: 2006-02-23 # -# Purpose: See if replication between # -# NDB -> MyISAM and InnoDB works. # -# and if # -# MyISAM and InnoDB -> NDB works. # -####################################### -# By JBM # -# Date 2006-02-28 # -# Change: Implemented review comments # -####################################### - ---echo --- Doing pre test cleanup --- - -connection master; ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_query_log - ---echo --- Start test 1 Basic testing --- ---echo --- Create Table Section --- - -################################################# -# Requirment: Create basic table, replicate # -# basice operations such at insert, update # -# delete between 2 different storage engines # -# Alter table and ensure table is handled # -# Correctly on the slave # -################################################# - -CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), - bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, - f FLOAT DEFAULT 0, total BIGINT UNSIGNED, - y YEAR, t DATE,PRIMARY KEY(id)); - ---echo --- Show table on master --- - -SHOW CREATE TABLE t1; - ---echo --- Show table on slave --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - -# Okay lets see how it holds up to table changes ---echo --- Check that simple Alter statements are replicated correctly -- - -ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); -ALTER TABLE t1 MODIFY vc TEXT; - ---echo --- Show the new improved table on the master --- - -SHOW CREATE TABLE t1; - ---echo --- Make sure that our tables on slave are still same engine --- ---echo --- and that the alter statements replicated correctly --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - ---echo --- End test 1 Basic testing --- ---echo --- Do Cleanup -- - -DROP TABLE IF EXISTS t1; - -################################################################# - ---echo --- Start test 2 partition RANGE testing -- ---echo --- Do setup -- - - -################################################# -# Requirment: Create table that is partitioned # -# by range on year i.e. year(t) and replicate # -# basice operations such at insert, update # -# delete between 2 different storage engines # -# Alter table and ensure table is handled # -# Correctly on the slave # -################################################# - -CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), - bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, - f FLOAT DEFAULT 0, total BIGINT UNSIGNED, - y YEAR, t DATE) - PARTITION BY RANGE (YEAR(t)) - (PARTITION p0 VALUES LESS THAN (1901), - PARTITION p1 VALUES LESS THAN (1946), - PARTITION p2 VALUES LESS THAN (1966), - PARTITION p3 VALUES LESS THAN (1986), - PARTITION p4 VALUES LESS THAN (2005), - PARTITION p5 VALUES LESS THAN MAXVALUE); - ---echo --- Show table on master --- - -SHOW CREATE TABLE t1; - ---echo --- Show table on slave -- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - ---echo --- Check that simple Alter statements are replicated correctly --- - -ALTER TABLE t1 ADD PRIMARY KEY(t,id); -ALTER TABLE t1 MODIFY vc TEXT; - ---echo --- Show the new improved table on the master --- - -SHOW CREATE TABLE t1; - ---echo --- Make sure that our tables on slave are still same engine --- ---echo --- and that the alter statements replicated correctly --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- ---enable_query_log - ---source include/rpl_multi_engine3.inc - ---echo --- End test 2 partition RANGE testing --- ---echo --- Do Cleanup --- - -DROP TABLE IF EXISTS t1; - -######################################################## - ---echo --- Start test 3 partition LIST testing --- ---echo --- Do setup --- -################################################# -# Requirment: Create table that is partitioned # -# by list on id i.e. (2,4). Pretend that we # -# missed one and alter to add. Then replicate # -# basice operations such at insert, update # -# delete between 2 different storage engines # -# Alter table and ensure table is handled # -# Correctly on the slave # -################################################# - - -CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), - bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, - f FLOAT DEFAULT 0, total BIGINT UNSIGNED, - y YEAR, t DATE) - PARTITION BY LIST(id) - (PARTITION p0 VALUES IN (2, 4), - PARTITION p1 VALUES IN (42, 142)); - ---echo --- Test 3 Alter to add partition --- - -ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); - ---echo --- Show table on master --- - -SHOW CREATE TABLE t1; - ---echo --- Show table on slave --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - ---echo --- Check that simple Alter statements are replicated correctly --- - -ALTER TABLE t1 ADD PRIMARY KEY(id); -ALTER TABLE t1 MODIFY vc TEXT; - ---echo --- Show the new improved table on the master --- - -SHOW CREATE TABLE t1; - ---echo --- Make sure that our tables on slave are still same engine --- ---echo --- and that the alter statements replicated correctly --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - ---echo --- End test 3 partition LIST testing --- ---echo --- Do Cleanup -- - -DROP TABLE IF EXISTS t1; - -######################################################## - ---echo --- Start test 4 partition HASH testing --- ---echo --- Do setup --- -################################################# -# Requirment: Create table that is partitioned # -# by hash on year i.e. YEAR(t). Then replicate # -# basice operations such at insert, update # -# delete between 2 different storage engines # -# Alter table and ensure table is handled # -# Correctly on the slave # -################################################# - - -CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), - bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, - f FLOAT DEFAULT 0, total BIGINT UNSIGNED, - y YEAR, t DATE) - PARTITION BY HASH( YEAR(t) ) - PARTITIONS 4; - ---echo --- show that tables have been created correctly --- - -SHOW CREATE TABLE t1; -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - ---echo --- Check that simple Alter statements are replicated correctly --- - -ALTER TABLE t1 ADD PRIMARY KEY(t,id); -ALTER TABLE t1 MODIFY vc TEXT; - ---echo --- Show the new improved table on the master --- - -SHOW CREATE TABLE t1; - ---echo --- Make sure that our tables on slave are still same engine --- ---echo --- and that the alter statements replicated correctly --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - ---echo --- End test 4 partition HASH testing --- ---echo --- Do Cleanup -- - -DROP TABLE IF EXISTS t1; - -######################################################## - ---echo --- Start test 5 partition by key testing --- ---echo --- Create Table Section --- - -################################################# -# Requirment: Create table that is partitioned # -# by key on id with 4 parts. Then replicate # -# basice operations such at insert, update # -# delete between 2 different storage engines # -# Alter table and ensure table is handled # -# Correctly on the slave # -################################################# - -CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), - bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, - f FLOAT DEFAULT 0, total BIGINT UNSIGNED, - y YEAR, t DATE,PRIMARY KEY(id)) - PARTITION BY KEY() - PARTITIONS 4; - ---echo --- Show that tables on master are ndbcluster tables --- - -SHOW CREATE TABLE t1; - ---echo --- Show that tables on slave --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - -# Okay lets see how it holds up to table changes ---echo --- Check that simple Alter statements are replicated correctly --- - -ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); - ---echo --- Show the new improved table on the master --- - -SHOW CREATE TABLE t1; - ---echo --- Make sure that our tables on slave are still right type --- ---echo --- and that the alter statements replicated correctly --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - ---echo --- Check that simple Alter statements are replicated correctly --- - -ALTER TABLE t1 MODIFY vc TEXT; - ---echo --- Show the new improved table on the master --- - -SHOW CREATE TABLE t1; - ---echo --- Make sure that our tables on slave are still same engine --- ---echo --- and that the alter statements replicated correctly --- - -sync_slave_with_master; -SHOW CREATE TABLE t1; - ---echo --- Perform basic operation on master --- ---echo --- and ensure replicated correctly --- - ---source include/rpl_multi_engine3.inc - ---echo --- End test 5 key partition testing --- ---echo --- Do Cleanup --- - -DROP TABLE IF EXISTS t1; -sync_slave_with_master; - -# End of 5.1 test case diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test deleted file mode 100644 index bba860ab9aa..00000000000 --- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test +++ /dev/null @@ -1,307 +0,0 @@ -############################################# -#Authors: TU and Jeb -#Date: 2007/04 -#Purpose: Generic replication to cluster -# and ensuring that the ndb_apply_status -# table is updated. -############################################# -# Notes: -# include/select_ndb_apply_status.inc -# Selects out the log name, start & end pos -# from the ndb_apply_status table -# -# include/show_binlog_using_logname.inc -# To select out 1 row from offset 1 -# from the start position in the binlog whose -# name is = log_name -# -# include/tpcb.inc -# Creates DATABASE tpcb, the tables and -# stored procedures for loading the DB -# and for running transactions against DB. -############################################## - - ---echo ---echo *** Test 1 *** ---echo - -connection master; -create table t1 (a int key, b int) engine innodb; -create table t2 (a int key, b int) engine innodb; - ---echo - ---sync_slave_with_master -alter table t1 engine ndb; -alter table t2 engine ndb; - ---echo - -# check binlog position without begin -connection master; -insert into t1 values (1,2); - ---echo - ---sync_slave_with_master ---source include/select_ndb_apply_status.inc - ---echo - -connection master; ---echo # Now check that that is in the apply_status table is consistant ---echo # with what is in the binlog ---echo ---echo # since insert is done with transactional engine, expect a BEGIN ---echo # at ---echo ---let $binlog_start= $start_pos ---let $binlog_limit= 1 ---source include/show_binlog_events.inc - ---echo ---echo # Now the insert, one step after ---echo ---let $binlog_start= $start_pos ---let $binlog_limit= 1,1 ---source include/show_binlog_events.inc - ---echo ---echo # and the COMMIT should be at ---echo ---let $binlog_start= $start_pos ---let $binlog_limit= 2,1 ---source include/show_binlog_events.inc - ---echo - -# check binlog position with begin -begin; -insert into t1 values (2,3); -insert into t2 values (3,4); -commit; - ---echo - ---sync_slave_with_master ---source include/select_ndb_apply_status.inc - -connection master; ---let $binlog_start= $start_pos ---let $binlog_limit= 1 ---source include/show_binlog_events.inc ---echo ---let $binlog_start= $start_pos ---let $binlog_limit= 1,2 ---source include/show_binlog_events.inc ---echo ---let $binlog_start= $start_pos ---let $binlog_limit= 3,1 ---source include/show_binlog_events.inc - ---echo - -connection master; -DROP TABLE test.t1, test.t2; ---sync_slave_with_master -SHOW TABLES; - -# Run in some transactions using stored procedures -# and ensure that the ndb_apply_status table is -# updated to show the transactions - - ---echo ---echo *** Test 2 *** ---echo - -# Create database/tables and stored procdures -connection master; ---source include/tpcb.inc - -# Switch tables on slave to use NDB ---sync_slave_with_master -USE tpcb; -ALTER TABLE account ENGINE NDB; -ALTER TABLE branch ENGINE NDB; -ALTER TABLE teller ENGINE NDB; -ALTER TABLE history ENGINE NDB; - ---echo - -# Load DB tpcb and run some transactions -connection master; ---disable_query_log -CALL tpcb.load(); -SET AUTOCOMMIT=0; -let $run= 5; -while ($run) -{ - START TRANSACTION; - --disable_warnings - --eval CALL tpcb.trans($rpl_format); - --enable_warnings - eval SET @my_errno= $mysql_errno; - let $run_good= `SELECT @my_errno = 0`; - let $run_bad= `SELECT @my_errno <> 0`; - if ($run_good) - { - COMMIT; - } - if ($run_bad) - { - ROLLBACK; - } - dec $run; -} - -SET AUTOCOMMIT=1; ---enable_query_log - ---sync_slave_with_master ---source include/select_ndb_apply_status.inc - ---echo - -connection master; ---source include/show_binlog_using_logname.inc - -# Flush the logs on the master moving all -# Transaction to a new binlog and ensure -# that the ndb_apply_status table is updated -# to show the use of the new binlog. - ---echo ---echo ** Test 3 ** ---echo - -# Flush logs on master which should force it -# to switch to binlog #2 - -FLUSH LOGS; - -# Run in some transaction to increase end pos in -# binlog - ---disable_query_log -SET AUTOCOMMIT=0; -let $run= 5; -while ($run) -{ - START TRANSACTION; - --disable_warnings - --eval CALL tpcb.trans($rpl_format); - --enable_warnings - eval SET @my_errno= $mysql_errno; - let $run_good= `SELECT @my_errno = 0`; - let $run_bad= `SELECT @my_errno <> 0`; - if ($run_good) - { - COMMIT; - } - if ($run_bad) - { - ROLLBACK; - } - dec $run; -} -SET AUTOCOMMIT=1; ---enable_query_log - ---echo - ---sync_slave_with_master ---source include/select_ndb_apply_status.inc - ---echo - -connection master; ---source include/show_binlog_using_logname.inc - -# Now we reset both the master and the slave -# Run some more transaction and ensure -# that the ndb_apply_status is updated -# correctly - ---echo ---echo ** Test 4 ** ---echo - -# Reset both slave and master -# This should reset binlog to #1 ---source include/rpl_reset.inc - ---echo - -# Run in some transactions and check -connection master; ---disable_query_log -SET AUTOCOMMIT=0; -let $run= 5; -while ($run) -{ - START TRANSACTION; - --disable_warnings - --eval CALL tpcb.trans($rpl_format); - --enable_warnings - eval SET @my_errno= $mysql_errno; - let $run_good= `SELECT @my_errno = 0`; - let $run_bad= `SELECT @my_errno <> 0`; - if ($run_good) - { - COMMIT; - } - if ($run_bad) - { - ROLLBACK; - } - dec $run; -} -SET AUTOCOMMIT=1; ---enable_query_log - ---sync_slave_with_master ---source include/select_ndb_apply_status.inc - ---echo - -connection master; ---source include/show_binlog_using_logname.inc - -# Since we are doing replication, it is a good -# idea to check to make sure all data was -# Replicated correctly - ---echo ---echo *** DUMP MASTER & SLAVE FOR COMPARE ******** - ---exec $MYSQL_DUMP -n -t --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/master_apply_status.sql - ---exec $MYSQL_DUMP_SLAVE -n -t --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql - -connection master; -DROP DATABASE tpcb; - ---sync_slave_with_master - -####### Commenting out until decision on Bug#27960 ########### - -#--source include/select_ndb_apply_status.inc - -#connection master; -#--eval SHOW BINLOG EVENTS in '$log_name' from $start_pos -#--source include/show_binlog_using_logname.inc - ---echo ****** Do dumps compare ************ - - -diff_files $MYSQLTEST_VARDIR/tmp/master_apply_status.sql $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql; - -## Note: Ths files should only get removed, if the above diff succeeds. - ---exec rm $MYSQLTEST_VARDIR/tmp/master_apply_status.sql ---exec rm $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql - - -# End of 5.1 Test diff --git a/mysql-test/extra/rpl_tests/rpl_partition.test b/mysql-test/extra/rpl_tests/rpl_partition.test index 8f2956bf1ef..119e3bebc42 100644 --- a/mysql-test/extra/rpl_tests/rpl_partition.test +++ b/mysql-test/extra/rpl_tests/rpl_partition.test @@ -201,11 +201,11 @@ CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(255), PARTITION BY KEY() PARTITIONS 4; ---echo --- Show that tables on master are ndbcluster tables --- +--echo --- Show tables on master --- SHOW CREATE TABLE t1; ---echo --- Show that tables on slave --- +--echo --- Show tables on slave --- sync_slave_with_master; SHOW CREATE TABLE t1; diff --git a/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-test/extra/rpl_tests/rpl_row_blob.test index 762daa816c0..5cd7b6b4b29 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_blob.test +++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test @@ -36,7 +36,6 @@ SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3; save_master_pos; connection slave; sync_with_master; ---source include/wait_for_ndb_to_binlog.inc --echo --echo **** Data Insert Validation Slave Section test.t1 **** --echo @@ -59,7 +58,6 @@ SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; save_master_pos; connection slave; sync_with_master; ---source include/wait_for_ndb_to_binlog.inc --echo --echo **** Data Update Validation Slave Section test.t1 **** --echo @@ -130,7 +128,6 @@ FROM test.t2 WHERE c1=2; save_master_pos; connection slave; sync_with_master; ---source include/wait_for_ndb_to_binlog.inc --echo --echo **** Data Insert Validation Slave Section test.t2 **** --echo @@ -156,7 +153,6 @@ FROM test.t2 WHERE c1=2; save_master_pos; connection slave; sync_with_master; ---source include/wait_for_ndb_to_binlog.inc --echo --echo **** Data Update Validation Slave Section test.t2 **** --echo @@ -176,8 +172,4 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql $MYSQLTEST_VARDIR/tmp/r DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; # ensure cleanup on slave as well: -# ndb blob tables consist of several tables -# if cluster is shutdown while not all tables are -# properly dropped, the table becomes inconsistent -# and wrecks later test cases --sync_slave_with_master diff --git a/mysql-test/extra/rpl_tests/rpl_row_func003.test b/mysql-test/extra/rpl_tests/rpl_row_func003.test index d12b5a3306a..f46f9eddc60 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_func003.test +++ b/mysql-test/extra/rpl_tests/rpl_row_func003.test @@ -54,11 +54,8 @@ INSERT INTO test.t1 VALUES (null,test.f1()); ROLLBACK; SET AUTOCOMMIT=1; -# Sync master and slave for all engines except NDB -if (`SELECT UPPER(LEFT('$engine_type', 3)) != 'NDB'`) { sync_slave_with_master; connection master; -} # Time to dump the databases and so we can see if they match diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test index d2c2ea0caf3..a8f25485f26 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test @@ -53,8 +53,6 @@ SELECT release_lock("test"); connection master; SELECT * FROM test.t1; -#show binlog events; ---source include/wait_for_ndb_to_binlog.inc sync_slave_with_master; connection slave; SELECT * FROM test.t1; diff --git a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test index 1687a233914..c6e91449fb3 100644 --- a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test +++ b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test @@ -8,8 +8,6 @@ SHOW VARIABLES LIKE 'relay_log_space_limit'; # Matz says: I have no idea what this is supposed to test, but it has # potential for generating different results with some storage engines # that process rows in an order not dependent on the insertion order. -# For instance, I would assume that distributed storage engines (like -# NDB) could process rows based on locality. eval CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=$engine_type; INSERT INTO t1 SET name='Andy', age=31; diff --git a/mysql-test/extra/rpl_tests/rpl_trig004.test b/mysql-test/extra/rpl_tests/rpl_trig004.test index 1a738db27fc..4988fe87f8f 100644 --- a/mysql-test/extra/rpl_tests/rpl_trig004.test +++ b/mysql-test/extra/rpl_tests/rpl_trig004.test @@ -7,7 +7,6 @@ ############################################################################# # Change Auth: JBM # # Date: 2006-02-14 # -# Change: Added error, sleep and comments (ndb) # #################################################### # Begin clean up test section @@ -28,15 +27,12 @@ CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO t delimiter ;// INSERT INTO test.t2 VALUES (1, 0.0); -# Expect duplicate error 1022 == ndb ---error 1022, ER_DUP_ENTRY +--error ER_DUP_ENTRY INSERT INTO test.t2 VALUES (1, 0.0); #show binlog events; select * from test.t1; select * from test.t2; -let $wait_time= 10; ---source include/wait_for_ndb_to_binlog.inc sync_slave_with_master; connection slave; select * from test.t1; diff --git a/mysql-test/include/ctype_utf8mb4.inc b/mysql-test/include/ctype_utf8mb4.inc index 9ee2414e142..1971cc0c9a1 100644 --- a/mysql-test/include/ctype_utf8mb4.inc +++ b/mysql-test/include/ctype_utf8mb4.inc @@ -191,17 +191,9 @@ drop table t1; # if(!$is_heap) { -if(!$is_ndb) -{ --error ER_TOO_LONG_KEY eval create table t1 (a text character set utf8mb4, primary key(a(371))) engine $engine; } -if($is_ndb) -{ ---error ER_BLOB_USED_AS_KEY -eval create table t1 (a text character set utf8mb4, primary key(a(371))) engine $engine; -} -} # # Bug 2959 @@ -254,8 +246,6 @@ drop table t2; # Bug 4521: unique key prefix interacts poorly with utf8mb4 # MYISAM: keys with prefix compression, case insensitive collation. # -if (!$is_ndb) -{ eval create table t1 (c varchar(30) character set utf8mb4, unique(c(10))) engine $engine; insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('aaaaaaaaaa'); @@ -549,7 +539,6 @@ select c as c_all from t1 order by c; select c as c_a from t1 where c='a'; select c as c_a from t1 where c='б'; drop table t1; -} # Bug#4594: column index make = failed for gbk, but like works @@ -593,8 +582,6 @@ drop table t1; # the same for HEAP+HASH # -if (!$is_ndb) -{ eval create table t1 ( str varchar(255) character set utf8mb4 not null, key str using hash (str(2)) @@ -618,7 +605,6 @@ INSERT INTO t1 VALUES ('str'); INSERT INTO t1 VALUES ('str2'); select * from t1 where str='str'; drop table t1; -} # # Bug #5397: Crash with varchar binary and LIKE @@ -651,8 +637,6 @@ DROP TABLE t1; # if (!$is_heap) { -if (!$is_ndb) -{ eval CREATE TABLE t1 ( id int unsigned NOT NULL auto_increment, list_id smallint unsigned NOT NULL, @@ -689,7 +673,6 @@ SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest"); SELECT id, term FROM t1 where (list_id = 1) AND (term = "testètest"); DROP TABLE t1; } -} # # Bug #6019 SELECT tries to use too short prefix index on utf8mb4 data @@ -979,14 +962,7 @@ if (!$is_heap) # eval CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8mb4) ENGINE $engine; INSERT INTO t1 VALUES(REPEAT('a', 100)); -if (!$is_ndb) -{ eval CREATE TEMPORARY TABLE t2 ENGINE $engine SELECT COALESCE(t) AS bug FROM t1; -} -if ($is_ndb) -{ -eval CREATE TABLE t2 ENGINE $engine SELECT COALESCE(t) AS bug FROM t1; -} SELECT LENGTH(bug) FROM t2; DROP TABLE t2; DROP TABLE t1; @@ -1202,8 +1178,6 @@ SET NAMES latin2; if (!$is_heap) { -if (!$is_ndb) -{ eval CREATE TABLE t1 ( id int(11) NOT NULL default '0', tid int(11) NOT NULL default '0', @@ -1229,7 +1203,6 @@ SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN DROP TABLE t1; } -} # # Bug 20709: problem with utf8mb4 fields in temporary tables @@ -1318,8 +1291,6 @@ drop table t1; # # Check that do_varstring2_mb produces a warning # -if (!$is_ndb) -{ eval create table t1 ( a varchar(4000) not null ) default character set utf8mb4 engine $engine; @@ -1327,7 +1298,6 @@ insert into t1 values (repeat('a',4000)); alter table t1 change a a varchar(3000) character set utf8mb4 not null; select length(a) from t1; drop table t1; -} # # Bug#10504: Character set does not support traditional mode @@ -1614,8 +1584,6 @@ set max_sort_length=default; --echo # if (!$is_heap) { -if (!$is_ndb) -{ eval CREATE TABLE t1 ( clipid INT NOT NULL, Tape TINYTEXT, @@ -1626,7 +1594,6 @@ ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; SHOW CREATE TABLE t1; DROP TABLE t1; } -} #--echo # #--echo # Check that supplementary characters are not allowed in identifiers @@ -1807,12 +1774,9 @@ INSERT INTO t2 VALUES (x'ea9da8'); SELECT HEX(CONCAT(utf8mb4, utf8mb3)) FROM t1,t2 ORDER BY 1; SELECT CHARSET(CONCAT(utf8mb4, utf8mb3)) FROM t1, t2 LIMIT 1; -if (!$is_ndb) -{ eval CREATE TEMPORARY TABLE t3 ENGINE $engine AS SELECT *, concat(utf8mb4,utf8mb3) FROM t1, t2; SHOW CREATE TABLE t3; DROP TEMPORARY TABLE t3; -} SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; SELECT * FROM t1, t2 WHERE t1.utf8mb4 = t2.utf8mb3; diff --git a/mysql-test/include/default_ndbd.cnf b/mysql-test/include/default_ndbd.cnf deleted file mode 100644 index 9a88a5936aa..00000000000 --- a/mysql-test/include/default_ndbd.cnf +++ /dev/null @@ -1,27 +0,0 @@ - -[cluster_config] -MaxNoOfSavedMessages= 1000 -MaxNoOfConcurrentTransactions= 128 -MaxNoOfConcurrentOperations= 10000 -DataMemory= 20M -IndexMemory= 1M -Diskless= 0 -TimeBetweenWatchDogCheck= 30000 -MaxNoOfOrderedIndexes= 32 -MaxNoOfAttributes= 2048 -TimeBetweenGlobalCheckpoints= 500 -NoOfFragmentLogFiles= 4 -FragmentLogFileSize= 12M -DiskPageBufferMemory= 4M - -# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612 -#ODirect= 1 -# the following parametes just function as a small regression -# test that the parameter exists -InitialNoOfOpenFiles= 27 - -# Increase timeouts for slow test-machines -HeartbeatIntervalDbDb= 30000 -HeartbeatIntervalDbApi= 30000 - -#TransactionDeadlockDetectionTimeout= 7500 diff --git a/mysql-test/include/have_aria.inc b/mysql-test/include/have_aria.inc new file mode 100644 index 00000000000..18f2b4b0063 --- /dev/null +++ b/mysql-test/include/have_aria.inc @@ -0,0 +1,4 @@ +if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'aria' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) +{ + --skip Test requires Aria +} diff --git a/mysql-test/include/have_innodb_disallow_writes.inc b/mysql-test/include/have_innodb_disallow_writes.inc new file mode 100644 index 00000000000..83b516b7a34 --- /dev/null +++ b/mysql-test/include/have_innodb_disallow_writes.inc @@ -0,0 +1,6 @@ +--source include/have_innodb.inc + +if (`SELECT COUNT(*) = 0 from INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME = 'INNODB_DISALLOW_WRITES'`) { + --skip Test requires 'innodb_disallow_writes' +} diff --git a/mysql-test/include/have_multi_ndb.inc b/mysql-test/include/have_multi_ndb.inc deleted file mode 100644 index 8dbfa2aa034..00000000000 --- a/mysql-test/include/have_multi_ndb.inc +++ /dev/null @@ -1,52 +0,0 @@ -# Setup connections to both MySQL Servers connected to the cluster -connect (server1,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,); - -# Check that server1 has NDB support -connection server1; -let $engines_table= query_get_value(SHOW TABLES FROM information_schema LIKE 'ENGINES', Tables_in_information_schema (ENGINES), 1); -disable_query_log; -if (`SELECT 1 FROM dual WHERE '$engines_table' = 'engines'`) -{ ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc -} -enable_query_log; - -# Check that server2 has NDB support -connection server2; -let $engines_table= query_get_value(SHOW TABLES FROM information_schema LIKE 'ENGINES', Tables_in_information_schema (ENGINES), 1); -disable_query_log; -if (`SELECT 1 FROM dual WHERE '$engines_table' = 'engines'`) -{ ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc -} -enable_query_log; - -# cleanup - -connection server1; -disable_query_log; -disable_warnings; ---error 0,1051 -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; -flush tables; -flush status; -enable_warnings; -enable_query_log; - -connection server2; -disable_query_log; -disable_warnings; ---error 0,1051 -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; -flush tables; -flush status; -enable_warnings; -enable_query_log; - -# Set the default connection -connection server1; diff --git a/mysql-test/include/have_mutex_deadlock_detector.inc b/mysql-test/include/have_mutex_deadlock_detector.inc index 3672f3eccef..88a7484a3e8 100644 --- a/mysql-test/include/have_mutex_deadlock_detector.inc +++ b/mysql-test/include/have_mutex_deadlock_detector.inc @@ -1,4 +1,3 @@ ---require r/have_mutex_deadlock_detector.require -disable_query_log; -select 1 from information_schema.global_variables where variable_name = "mutex_deadlock_detector"; -enable_query_log; +if (`select count(*)=0 from information_schema.global_variables where variable_name = "debug_mutex_deadlock_detector"`) { + skip needs safemutex deadlock detector; +} diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc deleted file mode 100644 index 1266f80c8cd..00000000000 --- a/mysql-test/include/have_ndb.inc +++ /dev/null @@ -1,2 +0,0 @@ -# Check that server is compiled and started with support for NDB ---source include/have_multi_ndb.inc diff --git a/mysql-test/include/have_ndb_extra.inc b/mysql-test/include/have_ndb_extra.inc deleted file mode 100644 index 4837a7ad4ea..00000000000 --- a/mysql-test/include/have_ndb_extra.inc +++ /dev/null @@ -1,2 +0,0 @@ --- require r/have_ndb_extra.require -eval select $NDB_EXTRA_TEST; diff --git a/mysql-test/include/have_ndbapi_examples.inc b/mysql-test/include/have_ndbapi_examples.inc deleted file mode 100644 index 88499d555c0..00000000000 --- a/mysql-test/include/have_ndbapi_examples.inc +++ /dev/null @@ -1,4 +0,0 @@ ---require r/have_ndbapi_examples.require -disable_query_log; -eval select LENGTH('$NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example'; -enable_query_log; diff --git a/mysql-test/include/have_wsrep.inc b/mysql-test/include/have_wsrep.inc new file mode 100644 index 00000000000..52220edf481 --- /dev/null +++ b/mysql-test/include/have_wsrep.inc @@ -0,0 +1,8 @@ +# To be used in a test which requires server to be compiled with wsrep support +# (-DWITH_WSREP=ON) and wsrep plugin is ACTIVE. + +if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'wsrep' AND PLUGIN_STATUS='ACTIVE'`) +{ + --skip Test requires wsrep plugin. +} + diff --git a/mysql-test/include/loaddata_autocom.inc b/mysql-test/include/loaddata_autocom.inc index bb286fb4169..3bf88fefa6d 100644 --- a/mysql-test/include/loaddata_autocom.inc +++ b/mysql-test/include/loaddata_autocom.inc @@ -1,5 +1,4 @@ # Test if the engine does autocommit in LOAD DATA INFILE, or not -# (NDB wants to do, others don't). eval SET SESSION STORAGE_ENGINE = $engine_type; @@ -9,8 +8,6 @@ drop table if exists t1; let $load_file= $MYSQLTEST_VARDIR/std_data/loaddata2.dat; -# NDB does not support the create option 'Binlog of table with BLOB attribute and no PK' -# So use a dummy PK here. create table t1 (id int unsigned not null auto_increment primary key, a text, b text); start transaction; --replace_result $load_file LOAD_FILE diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index e34e32ad1a6..e54041da1bc 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -47,7 +47,7 @@ BEGIN -- Show "mysql" database, tables and columns SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES - WHERE table_schema='mysql' AND table_name != 'ndb_apply_status' + WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, @@ -55,7 +55,7 @@ BEGIN numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS - WHERE table_schema='mysql' AND table_name != 'ndb_apply_status' + WHERE table_schema='mysql' ORDER BY columns_in_mysql; -- Dump all events, there should be none diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 0ad1079cd92..bc8d8044afb 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -115,9 +115,6 @@ INSERT INTO global_suppressions VALUES ("unknown variable 'loose-"), ("You have forced lower_case_table_names to 0 through a command-line option"), ("Setting lower_case_table_names=2"), - ("NDB Binlog:"), - ("NDB: failed to setup table"), - ("NDB: only row based binary logging"), ("Neither --relay-log nor --relay-log-index were used"), ("Query partially completed"), ("Slave I.O thread aborted while waiting for relay log"), @@ -139,7 +136,6 @@ INSERT INTO global_suppressions VALUES ("Slave: The incident LOST_EVENTS occured on the master"), ("Slave: Unknown error.* 1105"), ("Slave: Can't drop database.* database doesn't exist"), - ("Time-out in NDB"), ("Warning:\s+One can only use the --user.*root"), ("Warning:\s+Table:.* on (delete|rename)"), ("You have an error in your SQL syntax"), diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc deleted file mode 100644 index eef3bf2bd1e..00000000000 --- a/mysql-test/include/ndb_backup.inc +++ /dev/null @@ -1,48 +0,0 @@ -###################################################### -# By JBM 2006-02-16 So that the code is not repeated # -# in test cases and can be reused. # -###################################################### - ---exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT - -# To find the backupid, we must dump this data to a table, and SELECT -# what we want into an outfile. This could be accomplished with grep, but -# grep isn't Windows-portable - ---disable_query_log -# create a table to help us out ---disable_warnings # leave this on until done with the entire process -# cleanup -DROP TABLE IF EXISTS helper1; -CREATE TABLE helper1(c1 VARCHAR(20)); -# dump raw data to file -let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat; -let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat; ---disable_warnings ---error 0,1 ---remove_file $ndb_backup_file1 ---enable_warnings ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1 -# load the table from the raw data file -eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1; ---remove_file $ndb_backup_file1 -# output what we need -eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%' -INTO OUTFILE '$ndb_backup_file2'; -# cleanup -DROP TABLE helper1; ---enable_warnings ---enable_query_log - -CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info -(id INT, backup_id INT) ENGINE = MEMORY; - ---replace_result $MYSQLTEST_VARDIR -eval LOAD DATA INFILE '$ndb_backup_file2' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; ---remove_file $ndb_backup_file2 - -# Load backup id into environment variable -let the_backup_id=`SELECT backup_id from test.backup_info`; - -DROP TABLE test.backup_info; - diff --git a/mysql-test/include/ndb_backup_print.inc b/mysql-test/include/ndb_backup_print.inc deleted file mode 100644 index 69faa8f421b..00000000000 --- a/mysql-test/include/ndb_backup_print.inc +++ /dev/null @@ -1,9 +0,0 @@ ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat ---exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat ---disable_warnings ---error 0,1 ---remove_file $MYSQLTEST_VARDIR/tmp/tmp.dat ---enable_warnings ---let ndb_restore_opts= ---let ndb_restore_filter= diff --git a/mysql-test/include/ndb_default_cluster.inc b/mysql-test/include/ndb_default_cluster.inc deleted file mode 100644 index de7eda3c596..00000000000 --- a/mysql-test/include/ndb_default_cluster.inc +++ /dev/null @@ -1,4 +0,0 @@ --- require r/ndb_default_cluster.require -disable_query_log; -show status like "Ndb_config_from_host"; -enable_query_log; diff --git a/mysql-test/include/ndb_master-slave.inc b/mysql-test/include/ndb_master-slave.inc deleted file mode 100644 index 8305a310953..00000000000 --- a/mysql-test/include/ndb_master-slave.inc +++ /dev/null @@ -1,12 +0,0 @@ ---source include/master-slave.inc - -connection slave; -# Check that server is compiled and started with support for NDB -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc -enable_query_log; - -# Set the default connection to 'master' -connection master; diff --git a/mysql-test/include/ndb_master-slave_2ch.inc b/mysql-test/include/ndb_master-slave_2ch.inc deleted file mode 100644 index 17017d2b801..00000000000 --- a/mysql-test/include/ndb_master-slave_2ch.inc +++ /dev/null @@ -1,67 +0,0 @@ -# ==== Purpose ==== -# -# Set up circular cluster replication where each -# cluster has two mysqlds and replication directions are -# following: -# master ---> slave -# / \ -# cluster A cluster B -# \ / -# master1 <--- slave1 -# -# ==== Usage ==== -# -# [--let $rpl_server_count= N] -# [--let $rpl_skip_check_server_ids= 1] -# [--let $rpl_skip_reset_master_and_slave= 1] -# [--let $rpl_skip_change_master= 1] -# [--let $rpl_skip_start_slave= 1] -# [--let $rpl_debug= 1] -# [--let $slave_timeout= NUMBER] -# --source include/ndb_master-slave_2ch.inc -# -# Parameters: -# $rpl_server_count, $rpl_skip_check_server_ids, -# $rpl_skip_reset_master_and_slave, $rpl_skip_change_master, -# $rpl_skip_start_slave, $rpl_debug, $slave_timeout -# See include/master-slave.inc - ---let $rpl_topology= 1->2,4->3 ---let $rpl_skip_check_server_ids= 1 ---source include/rpl_init.inc - -# Make connections to mysqlds - ---let $rpl_connection_name= master ---let $rpl_server_number= 1 ---source include/rpl_connect.inc - ---let $rpl_connection_name= master1 ---let $rpl_server_number= 1 ---source include/rpl_connect.inc - ---let $rpl_connection_name= slave ---let $rpl_server_number= 2 ---source include/rpl_connect.inc - ---let $rpl_connection_name= slave1 ---let $rpl_server_number= 2 ---source include/rpl_connect.inc - - -# Check that all mysqld are compiled with ndb support ---let $_rpl_server= 4 -while ($_rpl_server) -{ - --connection server_$_rpl_server - if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'ndbcluster' AND (support = 'YES' OR support = 'DEFAULT')`) - { - --skip Test requires NDB. - } - --source include/ndb_not_readonly.inc - --dec $_rpl_server -} - - -# Set the default connection to 'master' (cluster A) -connection master; diff --git a/mysql-test/include/ndb_not_readonly.inc b/mysql-test/include/ndb_not_readonly.inc deleted file mode 100644 index ebb343bb18d..00000000000 --- a/mysql-test/include/ndb_not_readonly.inc +++ /dev/null @@ -1,36 +0,0 @@ -# Check that server has come out ot readonly mode -# -# wait for server to connect properly to cluster -# - ---disable_query_log - -set @saved_log = @@sql_log_bin; -set sql_log_bin = 0; ---error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY,ER_GET_ERRMSG,ER_KEY_NOT_FOUND -delete from mysql.ndb_apply_status where server_id=0; -let $mysql_errno= 1; -let $counter= 600; -while ($mysql_errno) -{ - # Table is readonly until the mysqld has connected properly - --error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY,ER_GET_ERRMSG - replace into mysql.ndb_apply_status values(0,0,"",0,0); - if ($mysql_errno) - { - if (!$counter) - { - die Failed while waiting for mysqld to come out of readonly mode; - } - dec $counter; - --sleep 0.1 - } -} -delete from mysql.ndb_apply_status where server_id=0; -set sql_log_bin = @saved_log; - ---enable_query_log - -# -# connected -# diff --git a/mysql-test/include/ndb_restore_master.inc b/mysql-test/include/ndb_restore_master.inc deleted file mode 100644 index ae5f055b442..00000000000 --- a/mysql-test/include/ndb_restore_master.inc +++ /dev/null @@ -1,8 +0,0 @@ -###################################################### -# By JBM 2006-02-16 So that the code is not repeated # -# in test cases and can be reused. # -###################################################### - ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT - ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT diff --git a/mysql-test/include/ndb_restore_slave_eoption.inc b/mysql-test/include/ndb_restore_slave_eoption.inc deleted file mode 100644 index a8657f68c8d..00000000000 --- a/mysql-test/include/ndb_restore_slave_eoption.inc +++ /dev/null @@ -1,11 +0,0 @@ -###################################################### -# By JBM 2006-03-08 So that the code is not repeated # -# in test cases and can be reused. # -###################################################### - ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT - ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT - - - diff --git a/mysql-test/include/ndb_setup_slave.inc b/mysql-test/include/ndb_setup_slave.inc deleted file mode 100644 index 5ee55150550..00000000000 --- a/mysql-test/include/ndb_setup_slave.inc +++ /dev/null @@ -1,27 +0,0 @@ -# -# now setup replication to continue from last epoch -# 1. get ndb_apply_status epoch from slave -# 2. get corresponding _next_ binlog postition from master -# 3. change master on slave - -# 1. ---connection slave ---replace_column 1 -SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status; ---let $the_epoch= `select @the_epoch` - -# 2. ---connection master ---replace_result $the_epoch ---replace_column 1 -eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) - FROM mysql.ndb_binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1; ---let $the_pos= `SELECT @the_pos` ---let $the_file= `SELECT @the_file` - -# 3. ---connection slave ---replace_result $the_pos -eval CHANGE MASTER TO - master_log_file = '$the_file', - master_log_pos = $the_pos ; diff --git a/mysql-test/include/ndb_wait_connected.inc b/mysql-test/include/ndb_wait_connected.inc deleted file mode 100644 index cfea94db1f1..00000000000 --- a/mysql-test/include/ndb_wait_connected.inc +++ /dev/null @@ -1,26 +0,0 @@ -# Check that mysqld has reconnected to ndbd after -# restart of ndbd -# ---disable_query_log ---disable_result_log -let $mysql_errno= 1; -let $counter= 600; -while ($mysql_errno) -{ - --error 0,157 - CREATE TABLE ndb_wait_connected (a int primary key); - if ($mysql_errno) - { - if (!$counter) - { - die Failed waiting for mysqld to reconnect to ndbd; - } - dec $counter; - --sleep 0.1 - } -} -DROP TABLE ndb_wait_connected; ---enable_query_log ---enable_result_log - - diff --git a/mysql-test/include/not_ndb.inc b/mysql-test/include/not_ndb.inc deleted file mode 100644 index 965538c20a7..00000000000 --- a/mysql-test/include/not_ndb.inc +++ /dev/null @@ -1,7 +0,0 @@ --- require r/not_ndb.require -disable_query_log; -# so that both DISABLED and NO is output as NO --- replace_result DISABLED NO -show variables like "have_ndbcluster"; -enable_query_log; - diff --git a/mysql-test/include/not_ndb_default.inc b/mysql-test/include/not_ndb_default.inc deleted file mode 100644 index 682a2944171..00000000000 --- a/mysql-test/include/not_ndb_default.inc +++ /dev/null @@ -1,4 +0,0 @@ ---require r/not_ndb_default.require -disable_query_log; -select convert(@@storage_engine using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE"; -enable_query_log; diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc index 2e42542d19a..dba182e0b3e 100644 --- a/mysql-test/include/ps_conv.inc +++ b/mysql-test/include/ps_conv.inc @@ -256,9 +256,14 @@ execute stmt1 using @my_key ; execute full_info ; --disable_metadata -# the next statement must fail ---error 1064 +# the next statement does not fail anymore prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; +execute stmt1 using @result; +--enable_metadata +execute full_info ; +--disable_metadata +select @result; + diff --git a/mysql-test/include/ps_query.inc b/mysql-test/include/ps_query.inc index 8148935cbe1..932e80f8b81 100644 --- a/mysql-test/include/ps_query.inc +++ b/mysql-test/include/ps_query.inc @@ -428,7 +428,6 @@ execute stmt1 using @arg01, @arg02; prepare stmt1 from ' select a, b FROM t1 outer_table where a = (select a from t1 where b = outer_table.b ) order by a '; # also Bug#4000 (only BDB tables) -# Bug#4106 : ndb table, query with correlated subquery, wrong result execute stmt1 ; # test case derived from client_test.c: test_subqueries_ref let $1= 3 ; diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc index 09569fc2b57..4ee4cccdc20 100644 --- a/mysql-test/include/rpl_init.inc +++ b/mysql-test/include/rpl_init.inc @@ -35,9 +35,7 @@ # (It is allowed, but not required, to configure SERVER_MYPORT_1 # and SERVER_MYPORT_2 too. If these variables are not set, the # variables MASTER_MYPORT and SLAVE_MYPORT, configured in the -# default my.cnf used by the rpl and rpl_ndb suites, are used -# instead. In addition, in the rpl_ndb suite, SERVER_MYPORT_3 is -# not needed since MASTER_MYPORT1 can be used instead.) +# default my.cnf used by the rpl suite, are used instead.) # # 2. Execute the following near the top of the test: # @@ -124,18 +122,6 @@ if (!$SERVER_MYPORT_2) { --let SERVER_MYPORT_2= $SLAVE_MYPORT } -# Allow $MASTER_MYPORT1 as alias for $SERVER_MYPORT_3 -# (this alias is used by rpl_ndb tests) -if (!$SERVER_MYPORT_3) -{ - --let SERVER_MYPORT_3= $MASTER_MYPORT1 -} -# Allow $SLAVE_MYPORT1 as alias for $SERVER_MYPORT_4 -# (this alias is used by rpl_ndb tests) -if (!$SERVER_MYPORT_4) -{ - --let SERVER_MYPORT_4= $SLAVE_MYPORT1 -} # Check that $rpl_server_count is set if (!$rpl_server_count) { diff --git a/mysql-test/include/rpl_multi_engine2.inc b/mysql-test/include/rpl_multi_engine2.inc index e683a1d5838..24154220cb0 100644 --- a/mysql-test/include/rpl_multi_engine2.inc +++ b/mysql-test/include/rpl_multi_engine2.inc @@ -72,10 +72,6 @@ ORDER BY id; connection master; --echo --- Remove a record from t1 on master --- -# Note: there is an error in replication of Delete_row -# from NDB to MyISAM (BUG#28538). However, if there is -# only one row in Delete_row event then it works fine, -# as this test demonstrates. DELETE FROM t1 WHERE id = 412; --echo --- Show current count on master for t1 --- diff --git a/mysql-test/include/safe_set_to_maybe_ro_var.inc b/mysql-test/include/safe_set_to_maybe_ro_var.inc deleted file mode 100644 index add7f2091b3..00000000000 --- a/mysql-test/include/safe_set_to_maybe_ro_var.inc +++ /dev/null @@ -1,23 +0,0 @@ -# to mask out the error - never abort neither log in result file - in setting -# to read-only variable. -# It is assumed that the new value is equal to one the var was set to. -# Such situation happens particularily with binlog_format that becomes read-only -# with ndb default storage. -# -# when generate results always watch the file to find what is expected, -# the SET query may fail - -# script accepts $maybe_ro_var the var name and $val4var the value - -### USAGE: -### let $maybe_ro_var= ... -### let $val4var= ... -### include/safe_set_to_maybe_ro_var.inc - ---disable_result_log ---disable_abort_on_error -eval SET $maybe_ro_var = $val4var; ---enable_abort_on_error ---enable_result_log - -eval SELECT $maybe_ro_var; diff --git a/mysql-test/include/select_ndb_apply_status.inc b/mysql-test/include/select_ndb_apply_status.inc deleted file mode 100644 index a676b7cfb06..00000000000 --- a/mysql-test/include/select_ndb_apply_status.inc +++ /dev/null @@ -1,13 +0,0 @@ -################################################## -# Author: Jeb -# Date: 2007/04 -# Purpose: To select out log name, start and end -# positions from ndb_apply_status table -################################################## ---replace_column 1 2 3 -select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos - from mysql.ndb_apply_status; ---let $start_pos = `select @start_pos` ---let $end_pos = `select @end_pos` ---let $log_name = `select @log_name` - diff --git a/mysql-test/include/wait_for_ndb_to_binlog.inc b/mysql-test/include/wait_for_ndb_to_binlog.inc deleted file mode 100644 index c1f94802724..00000000000 --- a/mysql-test/include/wait_for_ndb_to_binlog.inc +++ /dev/null @@ -1,26 +0,0 @@ -# ==== Purpose ==== -# -# Several test primitives from mysql-test/extra/rpl_tests -# are shared for test cases for MyISAM, InnoDB, NDB and -# other engines. -# For NDB engine all events will be added by NDB injector -# so tests only can continue after injector is ready, -# this test waits for proper injector thread state. -# -# ==== Usage ==== -# -# let $engine_type= NDB; -# --source include/wait_for_ndb_to_binlog.inc -# -# ==== Parameters ===== -# -# $engine_type -# Type of engine. If type is NDB then it waits for injector -# thread proper state. - -if (`SELECT UPPER(LEFT('$engine_type',3)) = 'NDB'`) { - let $show_statement= SHOW PROCESSLIST; - let $field= State; - let $condition= = 'Waiting for event from ndbcluster'; - source include/wait_show_condition.inc; -} diff --git a/mysql-test/include/word_size.combinations b/mysql-test/include/word_size.combinations new file mode 100644 index 00000000000..9b58a0c85c6 --- /dev/null +++ b/mysql-test/include/word_size.combinations @@ -0,0 +1,3 @@ +[32bit] + +[64bit] diff --git a/mysql-test/include/word_size.inc b/mysql-test/include/word_size.inc new file mode 100644 index 00000000000..fb796c251fc --- /dev/null +++ b/mysql-test/include/word_size.inc @@ -0,0 +1,4 @@ +# +# tests that include this file will be run for an appropriate combination. +# See word_size.combinations for the list of combinations. +# diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index 4e8507a5c4a..8c19ed58665 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -260,65 +260,6 @@ if (IS_WINDOWS) push(@mysqld_rules, {'shared-memory-base-name' => \&fix_socket}); } -sub fix_ndb_mgmd_port { - my ($self, $config, $group_name, $group)= @_; - my $hostname= $group->value('HostName'); - return $self->{PORT}++; -} - - -sub fix_cluster_dir { - my ($self, $config, $group_name, $group)= @_; - my $vardir= $self->{ARGS}->{vardir}; - my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name); - return "$vardir/mysql_cluster.$suffix/$process_type.$idx"; -} - - -sub fix_cluster_backup_dir { - my ($self, $config, $group_name, $group)= @_; - my $vardir= $self->{ARGS}->{vardir}; - my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name); - return "$vardir/mysql_cluster.$suffix/"; -} - - -# -# Rules to run for each ndb_mgmd in the config -# - will be run in order listed here -# -my @ndb_mgmd_rules= -( - { 'PortNumber' => \&fix_ndb_mgmd_port }, - { 'DataDir' => \&fix_cluster_dir }, -); - - -# -# Rules to run for each ndbd in the config -# - will be run in order listed here -# -my @ndbd_rules= -( - { 'HostName' => \&fix_host }, - { 'DataDir' => \&fix_cluster_dir }, - { 'BackupDataDir' => \&fix_cluster_backup_dir }, -); - - -# -# Rules to run for each cluster_config section -# - will be run in order listed here -# -my @cluster_config_rules= -( - { 'ndb_mgmd' => \&fix_host }, - { 'ndbd' => \&fix_host }, - { 'mysqld' => \&fix_host }, - { 'ndbapi' => \&fix_host }, -); - - # # Rules to run for [client] section # - will be run in order listed here @@ -496,49 +437,12 @@ sub post_fix_resolve_at_variables { } } -sub post_fix_mysql_cluster_section { - my ($self, $config)= @_; - - # Add a [mysl_cluster.] section for each - # defined [cluster_config.] section - foreach my $group ( $config->like('cluster_config\.\w*$') ) - { - my @urls; - # Generate ndb_connectstring for this cluster - foreach my $ndb_mgmd ( $config->like('cluster_config.ndb_mgmd.')) { - if ($ndb_mgmd->suffix() eq $group->suffix()) { - my $host= $ndb_mgmd->value('HostName'); - my $port= $ndb_mgmd->value('PortNumber'); - push(@urls, "$host:$port"); - } - } - croak "Could not generate valid ndb_connectstring for '$group'" - unless @urls > 0; - my $ndb_connectstring= join(";", @urls); - - # Add ndb_connectstring to [mysql_cluster.] - $config->insert('mysql_cluster'.$group->suffix(), - 'ndb_connectstring', $ndb_connectstring); - - # Add ndb_connectstring to each mysqld connected to this - # cluster - foreach my $mysqld ( $config->like('cluster_config.mysqld.')) { - if ($mysqld->suffix() eq $group->suffix()) { - my $after= $mysqld->after('cluster_config.mysqld'); - $config->insert("mysqld$after", - 'ndb_connectstring', $ndb_connectstring); - } - } - } -} - # # Rules to run last of all # my @post_rules= ( \&post_check_client_groups, - \&post_fix_mysql_cluster_section, \&post_fix_resolve_at_variables, \&post_check_embedded_group, ); @@ -576,54 +480,6 @@ sub run_section_rules { } -sub run_generate_sections_from_cluster_config { - my ($self, $config)= @_; - - my @options= ('ndb_mgmd', 'ndbd', - 'mysqld', 'ndbapi'); - - foreach my $group ( $config->like('cluster_config\.\w*$') ) { - - # Keep track of current index per process type - my %idxes; - map { $idxes{$_}= 1; } @options; - - foreach my $option_name ( @options ) { - my $value= $group->value($option_name); - my @hosts= split(/,/, $value, -1); # -1 => return also empty strings - - # Add at least one host - push(@hosts, undef) unless scalar(@hosts); - - # Assign hosts unless already fixed - @hosts= map { $self->fix_host() unless $_; } @hosts; - - # Write the hosts value back - $group->insert($option_name, join(",", @hosts)); - - # Generate sections for each host - foreach my $host ( @hosts ){ - my $idx= $idxes{$option_name}++; - - my $suffix= $group->suffix(); - # Generate a section for ndb_mgmd to read - $config->insert("cluster_config.$option_name.$idx$suffix", - "HostName", $host); - - if ($option_name eq 'mysqld'){ - my $datadir= - $self->fix_cluster_dir($config, - "cluster_config.mysqld.$idx$suffix", - $group); - $config->insert("mysqld.$idx$suffix", - 'datadir', "$datadir/data"); - } - } - } - } -} - - sub new_config { my ($class, $args)= @_; @@ -648,18 +504,6 @@ sub new_config { &$rule($self, $config); } - $self->run_section_rules($config, - 'cluster_config\.\w*$', - @cluster_config_rules); - $self->run_generate_sections_from_cluster_config($config); - - $self->run_section_rules($config, - 'cluster_config.ndb_mgmd.', - @ndb_mgmd_rules); - $self->run_section_rules($config, - 'cluster_config.ndbd', - @ndbd_rules); - $self->run_section_rules($config, 'mysqld.', @mysqld_rules); diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 441fd6e6559..97348cd39fc 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -36,7 +36,6 @@ our $do_test; our $skip_test; our $binlog_format; our $enable_disabled; -our $opt_with_ndbcluster_only; sub collect_option { my ($opt, $value)= @_; @@ -817,29 +816,6 @@ sub collect_one_test_case { return $tinfo } - if ( $tinfo->{'ndb_test'} ) - { - # This is a NDB test - if ( $::ndbcluster_enabled == 0) - { - # ndbcluster is disabled - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "ndbcluster disabled"; - return $tinfo; - } - } - else - { - # This is not a ndb test - if ( $opt_with_ndbcluster_only ) - { - # Only the ndb test should be run, all other should be skipped - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Only ndbcluster tests"; - return $tinfo; - } - } - if ( $tinfo->{'rpl_test'} ) { if ( $skip_rpl ) @@ -976,10 +952,7 @@ sub collect_one_test_case { my $tags_map= {'big_test' => ['big_test', 1], - 'have_ndb' => ['ndb_test', 1], - 'have_multi_ndb' => ['ndb_test', 1], 'master-slave' => ['rpl_test', 1], - 'ndb_master-slave' => ['rpl_test', 1, 'ndb_test', 1], 'long_test' => ['long_test', 1], }; my $tags_regex_string= join('|', keys %$tags_map); diff --git a/mysql-test/lib/v1/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index baeab24f519..067e7e5e4d1 100644 --- a/mysql-test/lib/v1/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -154,7 +154,6 @@ sub collect_test_cases ($) { # # Append the criteria for sorting, in order of importance. # - push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0")); # Group test with equal options together. # Ending with "~" makes empty sort later than filled push(@criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); @@ -788,8 +787,6 @@ sub collect_one_test_case($$$$$$$$$) { { # Different default engine is used # tag test to require that engine - $tinfo->{'ndb_test'}= 1 - if ( $::used_default_engine =~ /^ndb/i ); $tinfo->{'innodb_test'}= 1 if ( $::used_default_engine =~ /^innodb/i ); @@ -809,20 +806,6 @@ sub collect_one_test_case($$$$$$$$$) { return; } - if ( $tinfo->{'ndb_extra'} and ! $::opt_ndb_extra_test ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need 'ndb_extra' option"; - return; - } - - if ( $tinfo->{'require_manager'} ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need the _old_ manager(to be removed)"; - return; - } - if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries ) { $tinfo->{'skip'}= 1; @@ -830,38 +813,6 @@ sub collect_one_test_case($$$$$$$$$) { return; } - if ( $tinfo->{'ndb_test'} ) - { - # This is a NDB test - if ( ! $::glob_ndbcluster_supported ) - { - # Ndb is not supported, skip it - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No ndbcluster support"; - return; - } - elsif ( $::opt_skip_ndbcluster ) - { - # All ndb test's should be skipped - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)"; - return; - } - # Ndb tests run with two mysqld masters - $tinfo->{'master_num'}= 2; - } - else - { - # This is not a ndb test - if ( $::opt_with_ndbcluster_only ) - { - # Only the ndb test should be run, all other should be skipped - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Only ndbcluster tests(--with-ndbcluster-only)"; - return; - } - } - if ( $tinfo->{'innodb_test'} ) { # This is a test that need innodb @@ -916,10 +867,6 @@ our @tags= ["include/have_log_bin.inc", "need_binlog", 1], ["include/big_test.inc", "big_test", 1], ["include/have_debug.inc", "need_debug", 1], - ["include/have_ndb.inc", "ndb_test", 1], - ["include/have_multi_ndb.inc", "ndb_test", 1], - ["include/have_ndb_extra.inc", "ndb_extra", 1], - ["include/ndb_master-slave.inc", "ndb_test", 1], ["require_manager", "require_manager", 1], ["include/federated.inc", "federated_test", 1], ["include/have_federated_db.inc", "federated_test", 1], diff --git a/mysql-test/lib/v1/mtr_process.pl b/mysql-test/lib/v1/mtr_process.pl index f86f9e5dec0..3518b33839e 100644 --- a/mysql-test/lib/v1/mtr_process.pl +++ b/mysql-test/lib/v1/mtr_process.pl @@ -31,7 +31,6 @@ sub mtr_check_stop_servers ($); sub mtr_kill_leftovers (); sub mtr_wait_blocking ($); sub mtr_record_dead_children (); -sub mtr_ndbmgm_start($$); sub mtr_mysqladmin_start($$$); sub mtr_exit ($); sub sleep_until_file_created ($$$); @@ -342,10 +341,8 @@ sub mtr_process_exit_status { ############################################################################## -# Kill all processes(mysqld, ndbd, ndb_mgmd and im) that would conflict with -# this run +# Kill all processes that would conflict with this run # Make sure to remove the PID file, if any. -# kill IM manager first, else it will restart the servers sub mtr_kill_leftovers () { mtr_report("Killing Possible Leftover Processes"); @@ -376,46 +373,6 @@ sub mtr_kill_leftovers () { $srv->{'pid'}= 0; # Assume we are done with it } - if ( ! $::opt_skip_ndbcluster ) - { - - foreach my $cluster (@{$::clusters}) - { - - # Don't shut down a "running" cluster - next if $cluster->{'use_running'}; - - mtr_debug(" - cluster " . - "(pid: $cluster->{pid}; " . - "pid file: '$cluster->{path_pid})"); - - my $pid= mtr_ndbmgm_start($cluster, "shutdown"); - - # Save the pid of the ndb_mgm process - $admin_pids{$pid}= 1; - - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); - - $cluster->{'pid'}= 0; # Assume we are done with it - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - mtr_debug(" - ndbd " . - "(pid: $ndbd->{pid}; " . - "pid file: '$ndbd->{path_pid})"); - - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; # Assume we are done with it - } - } - } - # Wait for all the admin processes to complete mtr_wait_blocking(\%admin_pids); @@ -747,32 +704,6 @@ sub mtr_mysqladmin_start($$$) { } -# Start "ndb_mgm shutdown" for a specific cluster, it will -# shutdown all data nodes and leave the ndb_mgmd running -sub mtr_ndbmgm_start($$) { - my $cluster= shift; - my $command= shift; - - my $args; - - mtr_init_args(\$args); - - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--core"); - mtr_add_arg($args, "--try-reconnect=1"); - mtr_add_arg($args, "--ndb_connectstring=%s", $cluster->{'connect_string'}); - mtr_add_arg($args, "-e"); - mtr_add_arg($args, "$command"); - - my $pid= mtr_spawn($::exe_ndb_mgm, $args, - "", "/dev/null", "/dev/null", "", - {}); - mtr_verbose("mtr_ndbmgm_start, pid: $pid"); - return $pid; - -} - - # Ping all servers in list, exit when none of them answers # or when timeout has passed sub mtr_ping_with_timeout($) { @@ -843,25 +774,6 @@ sub mark_process_dead($) } } - foreach my $cluster (@{$::clusters}) - { - if ( $cluster->{'pid'} eq $ret_pid ) - { - mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid"); - $cluster->{'pid'}= 0; - return; - } - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - if ( $ndbd->{'pid'} eq $ret_pid ) - { - mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid"); - $ndbd->{'pid'}= 0; - return; - } - } - } mtr_warning("mark_process_dead couldn't find an entry for pid: $ret_pid"); } @@ -915,52 +827,6 @@ sub check_expected_crash_and_restart($) } } - foreach my $cluster (@{$::clusters}) - { - if ( $cluster->{'pid'} eq $ret_pid ) - { - mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid"); - $cluster->{'pid'}= 0; - - # Check if crash expected and restart if it was - my $expect_file= "$::opt_vardir/tmp/ndb_mgmd_" . "$cluster->{'type'}" . - ".expect"; - if ( -f $expect_file ) - { - mtr_verbose("Crash was expected, file $expect_file exists"); - unlink($expect_file); - ndbmgmd_start($cluster); - } - return; - } - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - if ( $ndbd->{'pid'} eq $ret_pid ) - { - mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid"); - $ndbd->{'pid'}= 0; - - # Check if crash expected and restart if it was - my $expect_file= "$::opt_vardir/tmp/ndbd_" . "$cluster->{'type'}" . - "$ndbd->{'idx'}" . ".expect"; - if ( -f $expect_file ) - { - mtr_verbose("Crash was expected, file $expect_file exists"); - unlink($expect_file); - ndbd_start($cluster, $ndbd->{'idx'}, - $ndbd->{'start_extra_args'}); - } - return; - } - } - } - - if ($::instance_manager->{'spawner_pid'} eq $ret_pid) - { - return; - } - mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid"); } diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl index accf00dbb5d..e2556d17093 100644 --- a/mysql-test/lib/v1/mtr_report.pl +++ b/mysql-test/lib/v1/mtr_report.pl @@ -287,9 +287,6 @@ sub mtr_report_stats ($) { /unknown variable 'loose-/ or /You have forced lower_case_table_names to 0 through a command-line option/ or /Setting lower_case_table_names=2/ or - /NDB Binlog:/ or - /NDB: failed to setup table/ or - /NDB: only row based binary logging/ or /Neither --relay-log nor --relay-log-index were used/ or /Query partially completed/ or /Slave I.O thread aborted while waiting for relay log/ or @@ -314,7 +311,6 @@ sub mtr_report_stats ($) { /Slave: Can't drop database.* database doesn't exist/ or /Slave SQL:.*(?:error.* \d+|Query:.*)/ or /Sort aborted/ or - /Time-out in NDB/ or /One can only use the --user.*root/ or /Table:.* on (delete|rename)/ or /You have an error in your SQL syntax/ or diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index baeb141f18c..79489d92742 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -92,7 +92,6 @@ our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl); require "lib/v1/mtr_cases.pl"; -require "lib/v1/mtr_im.pl"; require "lib/v1/mtr_process.pl"; require "lib/v1/mtr_timer.pl"; require "lib/v1/mtr_io.pl"; @@ -168,8 +167,6 @@ our $exe_mysqlimport; our $exe_mysqlshow; our $file_mysql_fix_privilege_tables; our $exe_mysqltest; -our $exe_ndbd; -our $exe_ndb_mgmd; our $exe_slave_mysqld; our $exe_my_print_defaults; our $exe_perror; @@ -233,19 +230,9 @@ our $opt_gprof_slave; our $master; our $slave; -our $clusters; - -our $instance_manager; our $opt_master_myport; our $opt_slave_myport; -our $im_port; -our $im_mysqld1_port; -our $im_mysqld2_port; -our $opt_ndbcluster_port; -our $opt_ndbconnectstring; -our $opt_ndbcluster_port_slave; -our $opt_ndbconnectstring_slave; our $opt_record; my $opt_report_features; @@ -257,7 +244,6 @@ our $max_slave_num= 0; our $max_master_num= 1; our $use_innodb; our $opt_skip_test; -our $opt_skip_im; our $opt_sleep; @@ -296,22 +282,9 @@ our $opt_stress_test_file= ""; our $opt_warnings; -our $opt_skip_ndbcluster= 0; -our $opt_skip_ndbcluster_slave= 0; -our $opt_with_ndbcluster= 0; -our $opt_with_ndbcluster_only= 0; -our $glob_ndbcluster_supported= 0; -our $opt_ndb_extra_test= 0; our $opt_skip_master_binlog= 0; our $opt_skip_slave_binlog= 0; -our $exe_ndb_mgm; -our $exe_ndb_waiter; -our $path_ndb_tools_dir; -our $path_ndb_examples_dir; -our $exe_ndb_example; -our $path_ndb_testrun_log; - our $path_sql_dir; our @data_dir_lst; @@ -345,11 +318,6 @@ sub remove_stale_vardir (); sub setup_vardir (); sub check_ssl_support ($); sub check_running_as_root(); -sub check_ndbcluster_support ($); -sub rm_ndbcluster_tables ($); -sub ndbcluster_start_install ($); -sub ndbcluster_start ($$); -sub ndbcluster_wait_started ($$); sub mysqld_wait_started($); sub run_benchmarks ($); sub initialize_servers (); @@ -363,8 +331,6 @@ sub run_testcase_check_skip_test($); sub report_failure_and_restart ($); sub do_before_start_master ($); sub do_before_start_slave ($); -sub ndbd_start ($$$); -sub ndb_mgmd_start ($); sub mysqld_start ($$$); sub mysqld_arguments ($$$$); sub stop_all_servers (); @@ -384,7 +350,6 @@ sub main () { command_line_setup(); - check_ndbcluster_support(\%mysqld_variables); check_ssl_support(\%mysqld_variables); check_debug_support(\%mysqld_variables); @@ -419,42 +384,18 @@ sub main () { if (!$opt_suites) { $opt_suites= $opt_suites_default; - - # Check for any extra suites to enable based on the path name - my %extra_suites= - ( - "mysql-5.1-new-ndb" => "ndb_team", - "mysql-5.1-new-ndb-merge" => "ndb_team", - "mysql-5.1-telco-6.2" => "ndb_team", - "mysql-5.1-telco-6.2-merge" => "ndb_team", - "mysql-5.1-telco-6.3" => "ndb_team", - "mysql-6.0-ndb" => "ndb_team", - ); - - foreach my $dir ( reverse splitdir($glob_basedir) ) - { - my $extra_suite= $extra_suites{$dir}; - if (defined $extra_suite){ - mtr_report("Found extra suite: $extra_suite"); - $opt_suites= "$extra_suite,$opt_suites"; - last; - } - } } my $tests= collect_test_cases($opt_suites); - # Turn off NDB and other similar options if no tests use it - my ($need_ndbcluster,$need_im, $need_debug); + my ($need_debug); foreach my $test (@$tests) { next if $test->{skip}; if (!$opt_extern) { - $need_ndbcluster||= $test->{ndb_test}; $need_debug||=$test->{need_debug}; - $need_im||= $test->{component_id} eq 'im'; # Count max number of slaves used by a test case if ( $test->{slave_num} > $max_slave_num) { @@ -472,30 +413,11 @@ sub main () { $use_innodb||= $test->{'innodb_test'}; } - # Check if cluster can be skipped - if ( !$need_ndbcluster ) - { - $opt_skip_ndbcluster= 1; - $opt_skip_ndbcluster_slave= 1; - } - if ( !$need_debug && !$opt_debug) { $opt_debug=0; } - # Check if slave cluster can be skipped - if ($max_slave_num == 0) - { - $opt_skip_ndbcluster_slave= 1; - } - - # Check if im can be skipped - if ( ! $need_im ) - { - $opt_skip_im= 1; - } - initialize_servers(); if ( $opt_report_features ) { @@ -580,23 +502,16 @@ sub command_line_setup () { 'compress' => \$opt_compress, 'bench' => \$opt_bench, 'small-bench' => \$opt_small_bench, - 'with-ndbcluster|ndb' => \$opt_with_ndbcluster, 'vs-config' => \$opt_vs_config, # Control what test suites or cases to run 'force' => \$opt_force, - 'with-ndbcluster-only' => \$opt_with_ndbcluster_only, - 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, - 'skip-ndbcluster-slave|skip-ndb-slave' - => \$opt_skip_ndbcluster_slave, - 'ndb-extra-test' => \$opt_ndb_extra_test, 'skip-master-binlog' => \$opt_skip_master_binlog, 'skip-slave-binlog' => \$opt_skip_slave_binlog, 'do-test=s' => \$opt_do_test, 'start-from=s' => \$opt_start_from, 'suite|suites=s' => \$opt_suites, 'skip-rpl' => \$opt_skip_rpl, - 'skip-im' => \$opt_skip_im, 'skip-test=s' => \$opt_skip_test, 'big-test' => \$opt_big_test, 'combination=s' => \@opt_combinations, @@ -605,11 +520,6 @@ sub command_line_setup () { # Specify ports 'master_port=i' => \$opt_master_myport, 'slave_port=i' => \$opt_slave_myport, - 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port, - 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave, - 'im-port=i' => \$im_port, # Instance Manager port. - 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM - 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM 'mtr-build-thread=i' => \$opt_mtr_build_thread, # Test case authoring @@ -625,8 +535,6 @@ sub command_line_setup () { # Run test on running server 'extern' => \$opt_extern, - 'ndb-connectstring=s' => \$opt_ndbconnectstring, - 'ndb-connectstring-slave=s' => \$opt_ndbconnectstring_slave, # Debugging 'gdb' => \$opt_gdb, @@ -800,7 +708,6 @@ sub command_line_setup () { push(@glob_test_mode, "embedded"); $opt_skip_rpl= 1; # We never run replication with embedded - $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster $opt_skip_ssl= 1; # Turn off use of SSL # Turn off use of bin log @@ -922,12 +829,6 @@ sub command_line_setup () { # -------------------------------------------------------------------------- # Find out default storage engine being used(if any) # -------------------------------------------------------------------------- - if ( $opt_with_ndbcluster ) - { - # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster - push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster"); - } - foreach my $arg ( @opt_extra_mysqld_opt ) { if ( $arg =~ /default-storage-engine=(\S+)/ ) @@ -1011,25 +912,6 @@ sub command_line_setup () { $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir; $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any - # -------------------------------------------------------------------------- - # Check im suport - # -------------------------------------------------------------------------- - if ($opt_extern) - { - # mtr_report("Disable instance manager when running with extern mysqld"); - $opt_skip_im= 1; - } - elsif ( $mysql_version_id < 50000 ) - { - # Instance manager is not supported until 5.0 - $opt_skip_im= 1; - } - elsif ( $glob_win32 ) - { - mtr_report("Disable Instance manager - testing not supported on Windows"); - $opt_skip_im= 1; - } - # -------------------------------------------------------------------------- # Record flag # -------------------------------------------------------------------------- @@ -1188,7 +1070,6 @@ sub command_line_setup () { path_sock => "$sockdir/master.sock", port => $opt_master_myport, start_timeout => 400, # enough time create innodb tables - cluster => 0, # index in clusters list start_opts => [], }; @@ -1203,7 +1084,6 @@ sub command_line_setup () { path_sock => "$sockdir/master1.sock", port => $opt_master_myport + 1, start_timeout => 400, # enough time create innodb tables - cluster => 0, # index in clusters list start_opts => [], }; @@ -1219,7 +1099,6 @@ sub command_line_setup () { port => $opt_slave_myport, start_timeout => 400, - cluster => 1, # index in clusters list start_opts => [], }; @@ -1234,7 +1113,6 @@ sub command_line_setup () { path_sock => "$sockdir/slave1.sock", port => $opt_slave_myport + 1, start_timeout => 300, - cluster => -1, # index in clusters list start_opts => [], }; @@ -1249,91 +1127,9 @@ sub command_line_setup () { path_sock => "$sockdir/slave2.sock", port => $opt_slave_myport + 2, start_timeout => 300, - cluster => -1, # index in clusters list start_opts => [], }; - $instance_manager= - { - path_err => "$opt_vardir/log/im.err", - path_log => "$opt_vardir/log/im.log", - path_pid => "$opt_vardir/run/im.pid", - path_angel_pid => "$opt_vardir/run/im.angel.pid", - path_sock => "$sockdir/im.sock", - port => $im_port, - start_timeout => $master->[0]->{'start_timeout'}, - admin_login => 'im_admin', - admin_password => 'im_admin_secret', - admin_sha1 => '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295', - password_file => "$opt_vardir/im.passwd", - defaults_file => "$opt_vardir/im.cnf", - }; - - $instance_manager->{'instances'}->[0]= - { - server_id => 1, - port => $im_mysqld1_port, - path_datadir => "$opt_vardir/im_mysqld_1.data", - path_sock => "$sockdir/mysqld_1.sock", - path_pid => "$opt_vardir/run/mysqld_1.pid", - start_timeout => 400, # enough time create innodb tables - old_log_format => 1 - }; - - $instance_manager->{'instances'}->[1]= - { - server_id => 2, - port => $im_mysqld2_port, - path_datadir => "$opt_vardir/im_mysqld_2.data", - path_sock => "$sockdir/mysqld_2.sock", - path_pid => "$opt_vardir/run/mysqld_2.pid", - nonguarded => 1, - start_timeout => 400, # enough time create innodb tables - old_log_format => 1 - }; - - my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port"; - $clusters->[0]= - { - name => "Master", - nodes => 2, - port => "$opt_ndbcluster_port", - data_dir => "$data_dir", - connect_string => "host=localhost:$opt_ndbcluster_port", - path_pid => "$data_dir/ndb_3.pid", # Nodes + 1 - pid => 0, # pid of ndb_mgmd - installed_ok => 0, - }; - - $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave"; - $clusters->[1]= - { - name => "Slave", - nodes => 1, - port => "$opt_ndbcluster_port_slave", - data_dir => "$data_dir", - connect_string => "host=localhost:$opt_ndbcluster_port_slave", - path_pid => "$data_dir/ndb_2.pid", # Nodes + 1 - pid => 0, # pid of ndb_mgmd - installed_ok => 0, - }; - - # Init pids of ndbd's - foreach my $cluster ( @{$clusters} ) - { - for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) - { - my $nodeid= $idx+1; - $cluster->{'ndbds'}->[$idx]= - { - pid => 0, - nodeid => $nodeid, - path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid", - path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs", - }; - } - } - # -------------------------------------------------------------------------- # extern # -------------------------------------------------------------------------- @@ -1341,7 +1137,6 @@ sub command_line_setup () { { # Turn off features not supported when running with extern server $opt_skip_rpl= 1; - $opt_skip_ndbcluster= 1; # Setup master->[0] with the settings for the extern server $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock"; @@ -1354,41 +1149,10 @@ sub command_line_setup () { } - # -------------------------------------------------------------------------- - # ndbconnectstring and ndbconnectstring_slave - # -------------------------------------------------------------------------- - if ( $opt_ndbconnectstring ) - { - # ndbconnectstring was supplied by user, the tests shoudl be run - # against an already started cluster, change settings - my $cluster= $clusters->[0]; # Master cluster - $cluster->{'connect_string'}= $opt_ndbconnectstring; - $cluster->{'use_running'}= 1; - - mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster") - if $opt_skip_ndbcluster; - } - $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'}; - - - if ( $opt_ndbconnectstring_slave ) - { - # ndbconnectstring-slave was supplied by user, the tests should be run - # agains an already started slave cluster, change settings - my $cluster= $clusters->[1]; # Slave cluster - $cluster->{'connect_string'}= $opt_ndbconnectstring_slave; - $cluster->{'use_running'}= 1; - - mtr_error("Can't specify ndb-connectstring_slave and " . - "--skip-ndbcluster-slave") - if $opt_skip_ndbcluster_slave; - } - $path_timefile= "$opt_vardir/log/mysqltest-time"; $path_mysqltest_log= "$opt_vardir/log/mysqltest.log"; $path_current_test_log= "$opt_vardir/log/current_test"; - $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; } @@ -1422,11 +1186,6 @@ sub set_mtr_build_thread_ports($) { # A magic value in command_line_setup depends on these equations. $opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1 $opt_slave_myport= $opt_master_myport + 2; # and 3 4 - $opt_ndbcluster_port= $opt_master_myport + 5; - $opt_ndbcluster_port_slave= $opt_master_myport + 6; - $im_port= $opt_master_myport + 7; - $im_mysqld1_port= $opt_master_myport + 8; - $im_mysqld2_port= $opt_master_myport + 9; if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 ) { @@ -1449,14 +1208,6 @@ sub datadir_list_setup () { { push(@data_dir_lst, $slave->[$idx]->{'path_myddir'}); } - - unless ($opt_skip_im) - { - foreach my $instance (@{$instance_manager->{'instances'}}) - { - push(@data_dir_lst, $instance->{'path_datadir'}); - } - } } @@ -1584,45 +1335,6 @@ sub collect_mysqld_features_from_running_server () } } -sub executable_setup_ndb () { - - # Look for ndb tols and binaries - my $ndb_path= mtr_file_exists("$glob_bindir/ndb", - "$glob_bindir/storage/ndb", - "$glob_bindir/bin"); - - $exe_ndbd= - mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd", - "$ndb_path/ndbd", - "$glob_bindir/libexec/ndbd"); - $exe_ndb_mgm= - mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm", - "$ndb_path/ndb_mgm"); - $exe_ndb_mgmd= - mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd", - "$ndb_path/ndb_mgmd", - "$glob_bindir/libexec/ndb_mgmd"); - $exe_ndb_waiter= - mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter", - "$ndb_path/ndb_waiter"); - - # May not exist - $path_ndb_tools_dir= mtr_file_exists("$ndb_path/tools", - "$ndb_path"); - # May not exist - $path_ndb_examples_dir= - mtr_file_exists("$ndb_path/ndbapi-examples", - "$ndb_path/examples"); - # May not exist - $exe_ndb_example= - mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple"); - - return ( $exe_ndbd eq "" or - $exe_ndb_mgm eq "" or - $exe_ndb_mgmd eq "" or - $exe_ndb_waiter eq ""); -} - sub executable_setup () { # @@ -1693,18 +1405,6 @@ sub executable_setup () { "$glob_basedir/share/mysql_fix_privilege_tables.sql", "$glob_basedir/share/mysql/mysql_fix_privilege_tables.sql"); - if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) - { - mtr_warning("Could not find all required ndb binaries, " . - "all ndb tests will fail, use --skip-ndbcluster to " . - "skip testing it."); - - foreach my $cluster (@{$clusters}) - { - $cluster->{"executable_setup_failed"}= 1; - } - } - # Look for the udf_example library $lib_udf_example= mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'), @@ -1870,14 +1570,6 @@ sub environment_setup () { } } - # -------------------------------------------------------------------------- - # Add the path where libndbclient can be found - # -------------------------------------------------------------------------- - if ( $glob_ndbcluster_supported ) - { - push(@ld_library_paths, "$glob_bindir/storage/ndb/src/.libs"); - } - # -------------------------------------------------------------------------- # Valgrind need to be run with debug libraries otherwise it's almost # impossible to add correct supressions, that means if "/usr/lib/debug" @@ -1955,64 +1647,10 @@ sub environment_setup () { $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'}; $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'}; - $ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock}; - $ENV{'IM_USERNAME'}= $instance_manager->{admin_login}; - $ENV{'IM_PASSWORD'}= $instance_manager->{admin_password}; $ENV{MTR_BUILD_THREAD}= $opt_mtr_build_thread; $ENV{'EXE_MYSQL'}= $exe_mysql; - - # ---------------------------------------------------- - # Setup env for NDB - # ---------------------------------------------------- - if ( ! $opt_skip_ndbcluster ) - { - $ENV{'NDB_MGM'}= $exe_ndb_mgm; - - $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port; - $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave; - - $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test; - - $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'}; - $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'}; - $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir; - $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log; - - if ( $mysql_version_id >= 50000 ) - { - $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir; - $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example; - } - $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log; - } - - # ---------------------------------------------------- - # Setup env for IM - # ---------------------------------------------------- - if ( ! $opt_skip_im ) - { - $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid}; - $ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid}; - $ENV{'IM_PORT'}= $instance_manager->{port}; - $ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file}; - $ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file}; - - $ENV{'IM_MYSQLD1_SOCK'}= - $instance_manager->{instances}->[0]->{path_sock}; - $ENV{'IM_MYSQLD1_PORT'}= - $instance_manager->{instances}->[0]->{port}; - $ENV{'IM_MYSQLD1_PATH_PID'}= - $instance_manager->{instances}->[0]->{path_pid}; - $ENV{'IM_MYSQLD2_SOCK'}= - $instance_manager->{instances}->[1]->{path_sock}; - $ENV{'IM_MYSQLD2_PORT'}= - $instance_manager->{instances}->[1]->{port}; - $ENV{'IM_MYSQLD2_PATH_PID'}= - $instance_manager->{instances}->[1]->{path_pid}; - } - # ---------------------------------------------------- # Setup env so childs can execute mysqlcheck # ---------------------------------------------------- @@ -2228,20 +1866,6 @@ sub environment_setup () { print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n"; print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n"; print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n"; - if ( ! $opt_skip_ndbcluster ) - { - print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n"; - if ( ! $opt_skip_ndbcluster_slave ) - { - print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n"; - } - } - if ( ! $opt_skip_im ) - { - print "Using IM_PORT = $ENV{IM_PORT}\n"; - print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n"; - print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n"; - } } # Create an environment variable to make it possible @@ -2599,155 +2223,6 @@ sub vs_config_dirs ($$) { "$glob_bindir/$path_part/debug/$exe"); } -############################################################################## -# -# Start the ndb cluster -# -############################################################################## - -sub check_ndbcluster_support ($) { - my $mysqld_variables= shift; - - if ($opt_skip_ndbcluster || $opt_extern) - { - if (!$opt_extern) - { - mtr_report("Skipping ndbcluster"); - } - $opt_skip_ndbcluster_slave= 1; - return; - } - - if ( ! $mysqld_variables->{'ndb-connectstring'} ) - { - mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster"); - $opt_skip_ndbcluster= 1; - $opt_skip_ndbcluster_slave= 1; - return; - } - $glob_ndbcluster_supported= 1; - mtr_report("Using ndbcluster when necessary, mysqld supports it"); - - if ( $mysql_version_id < 50100 ) - { - # Slave cluster is not supported until 5.1 - $opt_skip_ndbcluster_slave= 1; - - } - - return; -} - - -sub ndbcluster_start_install ($) { - my $cluster= shift; - - mtr_report("Installing $cluster->{'name'} Cluster"); - - mkdir($cluster->{'data_dir'}); - - # Create a config file from template - my $ndb_no_ord=512; - my $ndb_no_attr=2048; - my $ndb_con_op=105000; - my $ndb_dmem="80M"; - my $ndb_imem="24M"; - my $ndb_pbmem="32M"; - my $nodes= $cluster->{'nodes'}; - my $ndb_host= "localhost"; - my $ndb_diskless= 0; - - if (!$opt_bench) - { - # Use a smaller configuration - if ( $mysql_version_id < 50100 ) - { - # 4.1 and 5.0 is using a "larger" --small configuration - $ndb_no_ord=128; - $ndb_con_op=10000; - $ndb_dmem="40M"; - $ndb_imem="12M"; - } - else - { - $ndb_no_ord=32; - $ndb_con_op=10000; - $ndb_dmem="20M"; - $ndb_imem="1M"; - $ndb_pbmem="4M"; - } - } - - my $config_file_template= "lib/v1/ndb_config_${nodes}_node.ini"; - my $config_file= "$cluster->{'data_dir'}/config.ini"; - - open(IN, $config_file_template) - or mtr_error("Can't open $config_file_template: $!"); - open(OUT, ">", $config_file) - or mtr_error("Can't write to $config_file: $!"); - while () - { - chomp; - - s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/; - s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/; - s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/; - s/CHOOSE_DataMemory/$ndb_dmem/; - s/CHOOSE_IndexMemory/$ndb_imem/; - s/CHOOSE_Diskless/$ndb_diskless/; - s/CHOOSE_HOSTNAME_.*/$ndb_host/; - s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/; - s/CHOOSE_PORT_MGM/$cluster->{'port'}/; - if ( $mysql_version_id < 50000 ) - { - my $base_port= $cluster->{'port'} + 1; - s/CHOOSE_PORT_TRANSPORTER/$base_port/; - } - s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/; - - print OUT "$_ \n"; - } - close OUT; - close IN; - - - # Start cluster with "--initial" - - ndbcluster_start($cluster, "--initial"); - - return 0; -} - - -sub ndbcluster_wait_started($$){ - my $cluster= shift; - my $ndb_waiter_extra_opt= shift; - my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log"; - my $args; - - mtr_init_args(\$args); - - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--core"); - mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'}); - mtr_add_arg($args, "--timeout=60"); - - if ($ndb_waiter_extra_opt) - { - mtr_add_arg($args, "$ndb_waiter_extra_opt"); - } - - # Start the ndb_waiter which will connect to the ndb_mgmd - # and poll it for state of the ndbd's, will return when - # all nodes in the cluster is started - my $res= mtr_run($exe_ndb_waiter, $args, - "", $path_waiter_log, $path_waiter_log, ""); - mtr_verbose("ndbcluster_wait_started, returns: $res") if $res; - return $res; -} - - - sub mysqld_wait_started($){ my $mysqld= shift; @@ -2767,137 +2242,6 @@ sub mysqld_wait_started($){ } -sub ndb_mgmd_wait_started($) { - my ($cluster)= @_; - - my $retries= 100; - while (ndbcluster_wait_started($cluster, "--no-contact") and - $retries) - { - # Millisceond sleep emulated with select - select(undef, undef, undef, (0.1)); - - $retries--; - } - - return $retries == 0; - -} - -sub ndb_mgmd_start ($) { - my $cluster= shift; - - my $args; # Arg vector - my $pid= -1; - - mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--core"); - mtr_add_arg($args, "--nodaemon"); - mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini"); - - - my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log"; - $pid= mtr_spawn($exe_ndb_mgmd, $args, "", - $path_ndb_mgmd_log, - $path_ndb_mgmd_log, - "", - { append_log_file => 1 }); - - # FIXME Should not be needed - # Unfortunately the cluster nodes will fail to start - # if ndb_mgmd has not started properly - if (ndb_mgmd_wait_started($cluster)) - { - mtr_error("Failed to wait for start of ndb_mgmd"); - } - - # Remember pid of ndb_mgmd - $cluster->{'pid'}= $pid; - - mtr_verbose("ndb_mgmd_start, pid: $pid"); - - return $pid; -} - - -sub ndbd_start ($$$) { - my $cluster= shift; - my $idx= shift; - my $extra_args= shift; - - my $args; # Arg vector - my $pid= -1; - - mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); - mtr_add_arg($args, "--core"); - mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}"); - if ( $mysql_version_id >= 50000) - { - mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir"); - } - mtr_add_arg($args, "--nodaemon"); - mtr_add_arg($args, "$extra_args"); - - my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'}; - my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log"; - $pid= mtr_spawn($exe_ndbd, $args, "", - $path_ndbd_log, - $path_ndbd_log, - "", - { append_log_file => 1 }); - - # Add pid to list of pids for this cluster - $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid; - - # Rememeber options used when starting - $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args; - $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx; - - mtr_verbose("ndbd_start, pid: $pid"); - - return $pid; -} - - -sub ndbcluster_start ($$) { - my $cluster= shift; - my $extra_args= shift; - - mtr_verbose("ndbcluster_start '$cluster->{'name'}'"); - - if ( $cluster->{'use_running'} ) - { - return 0; - } - - if ( $cluster->{'pid'} ) - { - mtr_error("Cluster '$cluster->{'name'}' already started"); - } - - ndb_mgmd_start($cluster); - - for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) - { - ndbd_start($cluster, $idx, $extra_args); - } - - return 0; -} - - -sub rm_ndbcluster_tables ($) { - my $dir= shift; - foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"), - glob("$dir/mysql/ndb_schema*")) - { - unlink($bin); - } -} - - ############################################################################## # # Run the benchmark suite @@ -2929,11 +2273,6 @@ sub run_benchmarks ($) { mtr_add_arg($args, "--small-tables"); } - if ( $opt_with_ndbcluster ) - { - mtr_add_arg($args, "--create-options=TYPE=ndb"); - } - chdir($glob_mysql_bench_dir) or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!"); @@ -3078,69 +2417,6 @@ sub mysql_install_db () { copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'}); } - if ( ! $opt_skip_im ) - { - im_prepare_env($instance_manager); - } - - my $cluster_started_ok= 1; # Assume it can be started - - my $cluster= $clusters->[0]; # Master cluster - if ($opt_skip_ndbcluster || - $cluster->{'use_running'} || - $cluster->{executable_setup_failed}) - { - # Don't install master cluster - } - elsif (ndbcluster_start_install($cluster)) - { - mtr_warning("Failed to start install of $cluster->{name}"); - $cluster_started_ok= 0; - } - - $cluster= $clusters->[1]; # Slave cluster - if ($max_slave_num == 0 || - $opt_skip_ndbcluster_slave || - $cluster->{'use_running'} || - $cluster->{executable_setup_failed}) - { - # Don't install slave cluster - } - elsif (ndbcluster_start_install($cluster)) - { - mtr_warning("Failed to start install of $cluster->{name}"); - $cluster_started_ok= 0; - } - - foreach $cluster (@{$clusters}) - { - - next if !$cluster->{'pid'}; - - $cluster->{'installed_ok'}= 1; # Assume install suceeds - - if (ndbcluster_wait_started($cluster, "")) - { - # failed to install, disable usage and flag that its no ok - mtr_report("ndbcluster_install of $cluster->{'name'} failed"); - $cluster->{"installed_ok"}= 0; - - $cluster_started_ok= 0; - } - } - - if ( ! $cluster_started_ok ) - { - if ( $opt_force) - { - # Continue without cluster - } - else - { - mtr_error("To continue, re-run with '--force'."); - } - } - return 0; } @@ -3170,7 +2446,6 @@ sub install_db ($$) { mtr_add_arg($args, "--bootstrap"); mtr_add_arg($args, "--basedir=%s", $glob_basedir); mtr_add_arg($args, "--datadir=%s", $data_dir); - mtr_add_arg($args, "--loose-skip-ndbcluster"); mtr_add_arg($args, "--loose-skip-aria"); mtr_add_arg($args, "--disable-sync-frm"); mtr_add_arg($args, "--loose-disable-debug"); @@ -3268,105 +2543,6 @@ sub install_db ($$) { } -sub im_prepare_env($) { - my $instance_manager = shift; - - im_create_passwd_file($instance_manager); - im_prepare_data_dir($instance_manager); -} - - -sub im_create_passwd_file($) { - my $instance_manager = shift; - - my $pwd_file_path = $instance_manager->{'password_file'}; - - mtr_report("Creating IM password file ($pwd_file_path)"); - - open(OUT, ">", $pwd_file_path) - or mtr_error("Can't write to $pwd_file_path: $!"); - - print OUT $instance_manager->{'admin_login'}, ":", - $instance_manager->{'admin_sha1'}, "\n"; - - close(OUT); -} - - -sub im_create_defaults_file($) { - my $instance_manager = shift; - - my $defaults_file = $instance_manager->{'defaults_file'}; - - open(OUT, ">", $defaults_file) - or mtr_error("Can't write to $defaults_file: $!"); - - print OUT <{path_pid} -angel-pid-file = $instance_manager->{path_angel_pid} -socket = $instance_manager->{path_sock} -port = $instance_manager->{port} -password-file = $instance_manager->{password_file} -default-mysqld-path = $exe_mysqld - -EOF -; - - foreach my $instance (@{$instance_manager->{'instances'}}) - { - my $server_id = $instance->{'server_id'}; - - print OUT <{path_sock} -pid-file = $instance->{path_pid} -port = $instance->{port} -datadir = $instance->{path_datadir} -lc-messages-dir = $path_language -log = $instance->{path_datadir}/mysqld$server_id.log -log-error = $instance->{path_datadir}/mysqld$server_id.err.log -log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log -character-sets-dir = $path_charsetsdir -basedir = $glob_basedir -server_id = $server_id -shutdown-delay = 10 -skip-stack-trace -loose-skip-innodb -loose-skip-ndbcluster -EOF -; - if ( $mysql_version_id < 50100 ) - { - print OUT "skip-bdb\n"; - } - print OUT "nonguarded\n" if $instance->{'nonguarded'}; - if ( $mysql_version_id >= 50100 ) - { - print OUT "log-output=FILE\n" if $instance->{'old_log_format'}; - } - print OUT "\n"; - } - - close(OUT); -} - - -sub im_prepare_data_dir($) { - my $instance_manager = shift; - - foreach my $instance (@{$instance_manager->{'instances'}}) - { - copy_install_db( - 'im_mysqld_' . $instance->{'server_id'}, - $instance->{'path_datadir'}); - } -} - - - # # Restore snapshot of the installed slave databases # if the snapshot exists @@ -3423,56 +2599,6 @@ sub run_testcase_check_skip_test($) return 1; } - if ($tinfo->{'ndb_test'}) - { - foreach my $cluster (@{$clusters}) - { - # Slave cluster is skipped and thus not - # installed, no need to perform checks - last if ($opt_skip_ndbcluster_slave and - $cluster->{'name'} eq 'Slave'); - - # Using running cluster - no need - # to check if test should be skipped - # will be done by test itself - last if ($cluster->{'use_running'}); - - # If test needs this cluster, check binaries was found ok - if ( $cluster->{'executable_setup_failed'} ) - { - mtr_report_test_name($tinfo); - $tinfo->{comment}= - "Failed to find cluster binaries"; - mtr_report_test_failed($tinfo); - return 1; - } - - # If test needs this cluster, check it was installed ok - if ( !$cluster->{'installed_ok'} ) - { - mtr_report_test_name($tinfo); - $tinfo->{comment}= - "Cluster $cluster->{'name'} was not installed ok"; - mtr_report_test_failed($tinfo); - return 1; - } - - } - } - - if ( $tinfo->{'component_id'} eq 'im' ) - { - # If test needs im, check binaries was found ok - if ( $instance_manager->{'executable_setup_failed'} ) - { - mtr_report_test_name($tinfo); - $tinfo->{comment}= - "Failed to find MySQL manager binaries"; - mtr_report_test_failed($tinfo); - return 1; - } - } - return 0; } @@ -3492,15 +2618,6 @@ sub do_before_run_mysqltest($) if (!$opt_extern) { - if ( $mysql_version_id < 50000 ) { - # Set environment variable NDB_STATUS_OK to 1 - # if script decided to run mysqltest cluster _is_ installed ok - $ENV{'NDB_STATUS_OK'} = "1"; - } elsif ( $mysql_version_id < 50100 ) { - # Set environment variable NDB_STATUS_OK to YES - # if script decided to run mysqltest cluster _is_ installed ok - $ENV{'NDB_STATUS_OK'} = "YES"; - } if (defined $tinfo->{binlog_format} and $mysql_version_id > 50100 ) { # Dynamically switch binlog format of @@ -3552,16 +2669,6 @@ sub run_testcase_mark_logs($$) { mtr_tofile($mysqld->{path_myerr}, $log_msg); } - - if ( $tinfo->{'component_id'} eq 'im') - { - mtr_tofile($instance_manager->{path_err}, $log_msg); - mtr_tofile($instance_manager->{path_log}, $log_msg); - } - - # ndbcluster log file - mtr_tofile($path_ndb_testrun_log, $log_msg); - } sub find_testcase_skipped_reason($) @@ -3716,15 +2823,6 @@ sub run_testcase ($) { # Remove the file that mysqltest writes info to unlink($path_timefile); - - # ---------------------------------------------------------------------- - # Stop Instance Manager if we are processing an IM-test case. - # ---------------------------------------------------------------------- - if ( $tinfo->{'component_id'} eq 'im' and - !mtr_im_stop($instance_manager, $tinfo->{'name'})) - { - mtr_error("Failed to stop Instance Manager.") - } } @@ -3785,16 +2883,6 @@ sub restore_installed_db ($) { mtr_rmtree("$data_dir"); mtr_copy_dir("$path_snapshot/$name", "$data_dir"); } - - # Remove the ndb_*_fs dirs for all ndbd nodes - # forcing a clean start of ndb - foreach my $cluster (@{$clusters}) - { - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - mtr_rmtree("$ndbd->{'path_fs'}" ); - } - } } else { @@ -4025,23 +3113,6 @@ sub mysqld_arguments ($$$$) { $prefix); mtr_add_arg($args, "%s--local-infile", $prefix); - - my $cluster= $clusters->[$mysqld->{'cluster'}]; - if ( $cluster->{'pid'} || # Cluster is started - $cluster->{'use_running'} ) # Using running cluster - { - mtr_add_arg($args, "%s--ndbcluster", $prefix); - mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, - $cluster->{'connect_string'}); - if ( $mysql_version_id >= 50100 ) - { - mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); - } - } - else - { - mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix); - } } else { @@ -4109,25 +3180,6 @@ sub mysqld_arguments ($$$$) { mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id); mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank); } - - my $cluster= $clusters->[$mysqld->{'cluster'}]; - if ( $cluster->{'pid'} || # Slave cluster is started - $cluster->{'use_running'} ) # Using running slave cluster - { - mtr_add_arg($args, "%s--ndbcluster", $prefix); - mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, - $cluster->{'connect_string'}); - - if ( $mysql_version_id >= 50100 ) - { - mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); - } - } - else - { - mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix); - } - } # end slave if ( $debug_compiled_binaries && defined $opt_debug ) @@ -4315,15 +3367,6 @@ sub stop_all_servers () { mtr_report("Stopping All Servers"); - if ( ! $opt_skip_im ) - { - mtr_report("Shutting-down Instance Manager"); - unless (mtr_im_stop($instance_manager, "stop_all_servers")) - { - mtr_error("Failed to stop Instance Manager.") - } - } - my %admin_pids; # hash of admin processes that requests shutdown my @kill_pids; # list of processes to shutdown/kill my $pid; @@ -4349,45 +3392,11 @@ sub stop_all_servers () { } } - # Start shutdown of clusters - foreach my $cluster (@{$clusters}) - { - if ( $cluster->{'pid'} ) - { - $pid= mtr_ndbmgm_start($cluster, "shutdown"); - $admin_pids{$pid}= 1; - - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); - - $cluster->{'pid'}= 0; # Assume we are done with it - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - if ( $ndbd->{'pid'} ) - { - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; - } - } - } - } - # Wait blocking until all shutdown processes has completed mtr_wait_blocking(\%admin_pids); # Make sure that process has shutdown else try to kill them mtr_check_stop_servers(\@kill_pids); - - foreach my $mysqld (@{$master}, @{$slave}) - { - rm_ndbcluster_tables($mysqld->{'path_myddir'}); - } } @@ -4413,25 +3422,6 @@ sub run_testcase_need_master_restart($) $do_restart= 1; # Always restart if --force-restart in -opt file mtr_verbose("Restart master: Restart forced with --force-restart"); } - elsif ( ! $opt_skip_ndbcluster and - !$tinfo->{'ndb_test'} and - $clusters->[0]->{'pid'} != 0 ) - { - $do_restart= 1; # Restart without cluster - mtr_verbose("Restart master: Test does not need cluster"); - } - elsif ( ! $opt_skip_ndbcluster and - $tinfo->{'ndb_test'} and - $clusters->[0]->{'pid'} == 0 ) - { - $do_restart= 1; # Restart with cluster - mtr_verbose("Restart master: Test need cluster"); - } - elsif( $tinfo->{'component_id'} eq 'im' ) - { - $do_restart= 1; - mtr_verbose("Restart master: Always restart for im tests"); - } elsif ( $master->[0]->{'running_master_options'} and $master->[0]->{'running_master_options'}->{'timezone'} ne $tinfo->{'timezone'}) @@ -4556,30 +3546,6 @@ sub run_testcase_stop_servers($$$) { $mysqld->{'pid'}= 0; # Assume we are done with it } } - - # Start shutdown of master cluster - my $cluster= $clusters->[0]; - if ( $cluster->{'pid'} ) - { - $pid= mtr_ndbmgm_start($cluster, "shutdown"); - $admin_pids{$pid}= 1; - - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); - - $cluster->{'pid'}= 0; # Assume we are done with it - - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; # Assume we are done with it - } - } } if ( $do_restart || $do_slave_restart ) @@ -4609,31 +3575,6 @@ sub run_testcase_stop_servers($$$) { $mysqld->{'pid'}= 0; # Assume we are done with it } } - - # Start shutdown of slave cluster - my $cluster= $clusters->[1]; - if ( $cluster->{'pid'} ) - { - $pid= mtr_ndbmgm_start($cluster, "shutdown"); - - $admin_pids{$pid}= 1; - - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); - - $cluster->{'pid'}= 0; # Assume we are done with it - - foreach my $ndbd (@{$cluster->{'ndbds'}} ) - { - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; # Assume we are done with it - } - } } # ---------------------------------------------------------------------- @@ -4647,15 +3588,6 @@ sub run_testcase_stop_servers($$$) { # Make sure that process has shutdown else try to kill them mtr_check_stop_servers(\@kill_pids); - - foreach my $mysqld (@{$master}, @{$slave}) - { - if ( ! $mysqld->{'pid'} ) - { - # Remove ndbcluster tables if server is stopped - rm_ndbcluster_tables($mysqld->{'path_myddir'}); - } - } } @@ -4675,14 +3607,6 @@ sub run_testcase_start_servers($) { if ( $tinfo->{'component_id'} eq 'mysqld' ) { - if ( ! $opt_skip_ndbcluster and - !$clusters->[0]->{'pid'} and - $tinfo->{'ndb_test'} ) - { - # Test need cluster, cluster is not started, start it - ndbcluster_start($clusters->[0], ""); - } - if ( !$master->[0]->{'pid'} ) { # Master mysqld is not started @@ -4692,48 +3616,9 @@ sub run_testcase_start_servers($) { } - if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'} - and ! $master->[1]->{'pid'} and - $tinfo->{'master_num'} > 1 ) - { - # Test needs cluster, start an extra mysqld connected to cluster - - if ( $mysql_version_id >= 50100 ) - { - # First wait for first mysql server to have created ndb system - # tables ok FIXME This is a workaround so that only one mysqld - # create the tables - if ( ! sleep_until_file_created( - "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb", - $master->[0]->{'start_timeout'}, - $master->[0]->{'pid'})) - { - - $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table"; - return 1; - } - } - mysqld_start($master->[1],$tinfo->{'master_opt'},[]); - } - # Save this test case information, so next can examine it $master->[0]->{'running_master_options'}= $tinfo; } - elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' ) - { - # We have to create defaults file every time, in order to ensure that it - # will be the same for each test. The problem is that test can change the - # file (by SET/UNSET commands), so w/o recreating the file, execution of - # one test can affect the other. - - im_create_defaults_file($instance_manager); - - if ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) ) - { - $tinfo->{'comment'}= "Failed to start Instance Manager. "; - return 1; - } - } # ---------------------------------------------------------------------- # Start slaves - if needed @@ -4744,14 +3629,6 @@ sub run_testcase_start_servers($) { do_before_start_slave($tinfo); - if ( ! $opt_skip_ndbcluster_slave and - !$clusters->[1]->{'pid'} and - $tinfo->{'ndb_test'} ) - { - # Test need slave cluster, cluster is not started, start it - ndbcluster_start($clusters->[1], ""); - } - for ( my $idx= 0; $idx < $tinfo->{'slave_num'}; $idx++ ) { if ( ! $slave->[$idx]->{'pid'} ) @@ -4766,20 +3643,6 @@ sub run_testcase_start_servers($) { $slave->[0]->{'running_slave_options'}= $tinfo; } - # Wait for clusters to start - foreach my $cluster (@{$clusters}) - { - - next if !$cluster->{'pid'}; - - if (ndbcluster_wait_started($cluster, "")) - { - # failed to start - $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed"; - return 1; - } - } - # Wait for mysqld's to start foreach my $mysqld (@{$master},@{$slave}) { @@ -4908,14 +3771,7 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--mark-progress") if $opt_mark_progress; - if ($tinfo->{'component_id'} eq 'im') - { - mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'}); - mtr_add_arg($args, "--port=%d", $instance_manager->{'port'}); - mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'}); - mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'}); - } - else # component_id == mysqld + # component_id == mysqld { mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); mtr_add_arg($args, "--port=%d", $master->[0]->{'port'}); @@ -5325,7 +4181,6 @@ Options to control what engine/variation to run skip-ssl Dont start server with support for ssl connections bench Run the benchmark suite small-bench Run the benchmarks with --small-tests --small-tables - ndb|with-ndbcluster Use cluster as default table type vs-config Visual Studio configuration used to create executables (default: MTR_VS_CONFIG environment variable) @@ -5347,10 +4202,6 @@ Options to control directories to use Options to control what test suites or cases to run force Continue to run the suite after failure - with-ndbcluster-only Run only tests that include "ndb" in the filename - skip-ndb[cluster] Skip all tests that need cluster - skip-ndb[cluster]-slave Skip all tests that need a slave cluster - ndb-extra Run extra tests from ndb directory do-test=PREFIX or REGEX Run test cases which name are prefixed with PREFIX or fulfills REGEX @@ -5362,7 +4213,6 @@ Options to control what test suites or cases to run list of suite names. The default is: "$opt_suites_default" skip-rpl Skip the replication test cases. - skip-im Don't start IM, and skip the IM test cases big-test Set the environment variable BIG_TEST, which can be checked from test cases. combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one @@ -5373,8 +4223,6 @@ Options that specify ports master_port=PORT Specify the port number used by the first master slave_port=PORT Specify the port number used by the first slave - ndbcluster-port=PORT Specify the port number used by cluster - ndbcluster-port-slave=PORT Specify the port number used by slave cluster mtr-build-thread=# Specify unique collection of ports. Can also be set by setting the environment variable MTR_BUILD_THREAD. @@ -5391,8 +4239,6 @@ Options that pass on options Options to run test on running server extern Use running server for tests - ndb-connectstring=STR Use running cluster, and connect using STR - ndb-connectstring-slave=STR Use running slave cluster, and connect using STR user=USER User for connection to extern server socket=PATH Socket for connection to extern server diff --git a/mysql-test/lib/v1/ndb_config_1_node.ini b/mysql-test/lib/v1/ndb_config_1_node.ini deleted file mode 100644 index 4e0be7796dc..00000000000 --- a/mysql-test/lib/v1/ndb_config_1_node.ini +++ /dev/null @@ -1,47 +0,0 @@ -[ndbd default] -NoOfReplicas= 1 -MaxNoOfConcurrentTransactions= 64 -MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations -DataMemory= CHOOSE_DataMemory -IndexMemory= CHOOSE_IndexMemory -Diskless= CHOOSE_Diskless -TimeBetweenWatchDogCheck= 30000 -DataDir= CHOOSE_FILESYSTEM -MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes -MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes -TimeBetweenGlobalCheckpoints= 500 -NoOfFragmentLogFiles= 8 -FragmentLogFileSize= 6M -DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory - -# -# Increase timeouts to cater for slow test-machines -# (possibly running several tests in parallell) -# -HeartbeatIntervalDbDb= 30000 -HeartbeatIntervalDbApi= 30000 -#TransactionDeadlockDetectionTimeout= 7500 - -[ndbd] -HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress - -[ndb_mgmd] -HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress -DataDir= CHOOSE_FILESYSTEM # -PortNumber= CHOOSE_PORT_MGM - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] diff --git a/mysql-test/lib/v1/ndb_config_2_node.ini b/mysql-test/lib/v1/ndb_config_2_node.ini deleted file mode 100644 index 57e4d049ad6..00000000000 --- a/mysql-test/lib/v1/ndb_config_2_node.ini +++ /dev/null @@ -1,55 +0,0 @@ -[ndbd default] -NoOfReplicas= 2 -MaxNoOfConcurrentTransactions= 64 -MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations -DataMemory= CHOOSE_DataMemory -IndexMemory= CHOOSE_IndexMemory -Diskless= CHOOSE_Diskless -TimeBetweenWatchDogCheck= 30000 -DataDir= CHOOSE_FILESYSTEM -MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes -MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes -TimeBetweenGlobalCheckpoints= 500 -NoOfFragmentLogFiles= 4 -FragmentLogFileSize=12M -DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory -# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612 -#ODirect= 1 -# the following parametes just function as a small regression -# test that the parameter exists -InitialNoOfOpenFiles= 27 - -# -# Increase timeouts to cater for slow test-machines -# (possibly running several tests in parallell) -# -HeartbeatIntervalDbDb= 30000 -HeartbeatIntervalDbApi= 30000 -#TransactionDeadlockDetectionTimeout= 7500 - -[ndbd] -HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress - -[ndbd] -HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress - -[ndb_mgmd] -HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress -DataDir= CHOOSE_FILESYSTEM # -PortNumber= CHOOSE_PORT_MGM - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c2d44bf4db1..5e03bfea15b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -135,6 +135,9 @@ my $opt_start; my $opt_start_dirty; my $opt_start_exit; my $start_only; +my $file_wsrep_provider; + +our @global_suppressions; END { if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ ) @@ -187,6 +190,7 @@ my @DEFAULT_SUITES= qw( sys_vars- unit- vcol- + wsrep- ); my $opt_suites; @@ -337,16 +341,6 @@ sub check_timeout ($) { return testcase_timeout($_[0]) / 10; } our $opt_warnings= 1; -our $ndbcluster_enabled= 0; -my $opt_include_ndbcluster= 0; -my $opt_skip_ndbcluster= 0; - -my $exe_ndbd; -my $exe_ndbmtd; -my $exe_ndb_mgmd; -my $exe_ndb_waiter; -my $exe_ndb_mgm; - our %mysqld_variables; our @optional_plugins; @@ -409,7 +403,6 @@ sub main { # Run the mysqld to find out what features are available collect_mysqld_features(); } - check_ndbcluster_support(); check_ssl_support(); check_debug_support(); @@ -601,12 +594,6 @@ sub run_test_server ($$$) { my $test_failure= 0; # Set true if test suite failed my $extra_warnings= []; # Warnings found during server shutdowns - # Scheduler variables - my $max_ndb= $ENV{MTR_MAX_NDB} || $childs / 2; - $max_ndb = $childs if $max_ndb > $childs; - $max_ndb = 1 if $max_ndb < 1; - my $num_ndb_tests= 0; - my $completed= []; my %running; my $result; @@ -780,9 +767,6 @@ sub run_test_server ($$$) { mtr_error("'", $result->{name},"' is not known to be running") unless delete $running{$result->key()}; - # Update scheduler variables - $num_ndb_tests-- if ($result->{ndb_test}); - # Save result in completed list push(@$completed, $result); @@ -815,7 +799,6 @@ sub run_test_server ($$$) { # Find next test to schedule # - Try to use same configuration as worker used last time - # - Limit number of parallel ndb tests my $next; my $second_best; @@ -835,12 +818,6 @@ sub run_test_server ($$$) { redo; } - # Limit number of parallell NDB tests - if ($t->{ndb_test} and $num_ndb_tests >= $max_ndb){ - #mtr_report("Skipping, num ndb is already at max, $num_ndb_tests"); - next; - } - # From secondary choices, we prefer to pick a 'long-running' test if # possible; this helps avoid getting stuck with a few of those at the # end of high --parallel runs, with most workers being idle. @@ -893,7 +870,6 @@ sub run_test_server ($$$) { delete $next->{criteria}; $next->write_test($sock, 'TESTCASE'); $running{$next->key()}= $next; - $num_ndb_tests++ if ($next->{ndb_test}); } else { # No more test, tell child to exit @@ -1130,9 +1106,6 @@ sub command_line_setup { # Control what test suites or cases to run 'force+' => \$opt_force, - 'with-ndbcluster-only' => \&collect_option, - 'ndb|include-ndbcluster' => \$opt_include_ndbcluster, - 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, 'suite|suites=s' => \$opt_suites, 'skip-rpl' => \&collect_option, 'skip-test=s' => \&collect_option, @@ -2007,51 +1980,6 @@ sub executable_setup () { $exe_mysql_embedded= mtr_exe_maybe_exists("$basedir/libmysqld/examples/mysql_embedded"); - if ( $ndbcluster_enabled ) - { - # Look for single threaded NDB - $exe_ndbd= - my_find_bin($bindir, - ["storage/ndb/src/kernel", "libexec", "sbin", "bin"], - "ndbd"); - - # Look for multi threaded NDB - $exe_ndbmtd= - my_find_bin($bindir, - ["storage/ndb/src/kernel", "libexec", "sbin", "bin"], - "ndbmtd", NOT_REQUIRED); - if ($exe_ndbmtd) - { - my $mtr_ndbmtd = $ENV{MTR_NDBMTD}; - if ($mtr_ndbmtd) - { - mtr_report(" - multi threaded ndbd found, will be used always"); - $exe_ndbd = $exe_ndbmtd; - } - else - { - mtr_report(" - multi threaded ndbd found, will be ". - "used \"round robin\""); - } - } - - $exe_ndb_mgmd= - my_find_bin($bindir, - ["storage/ndb/src/mgmsrv", "libexec", "sbin", "bin"], - "ndb_mgmd"); - - $exe_ndb_mgm= - my_find_bin($bindir, - ["storage/ndb/src/mgmclient", "bin"], - "ndb_mgm"); - - $exe_ndb_waiter= - my_find_bin($bindir, - ["storage/ndb/tools/", "bin"], - "ndb_waiter"); - - } - # Look for mysqltest executable if ( $opt_embedded_server ) { @@ -2276,14 +2204,6 @@ sub environment_setup { } } - # -------------------------------------------------------------------------- - # Add the path where libndbclient can be found - # -------------------------------------------------------------------------- - if ( $ndbcluster_enabled ) - { - push(@ld_library_paths, "$basedir/storage/ndb/src/.libs"); - } - # -------------------------------------------------------------------------- # Valgrind need to be run with debug libraries otherwise it's almost # impossible to add correct supressions, that means if "/usr/lib/debug" @@ -2369,34 +2289,6 @@ sub environment_setup { # $ENV{HAVE_BROKEN_DNS}= defined(gethostbyname('invalid_hostname')); - # ---------------------------------------------------- - # Setup env for NDB - # ---------------------------------------------------- - if ( $ndbcluster_enabled ) - { - $ENV{'NDB_MGM'}= - my_find_bin($bindir, - ["storage/ndb/src/mgmclient", "bin"], - "ndb_mgm"); - - $ENV{'NDB_TOOLS_DIR'}= - my_find_dir($bindir, - ["storage/ndb/tools", "bin"]); - - $ENV{'NDB_EXAMPLES_DIR'}= - my_find_dir($basedir, - ["storage/ndb/ndbapi-examples", "bin"]); - - $ENV{'NDB_EXAMPLES_BINARY'}= - my_find_bin($bindir, - ["storage/ndb/ndbapi-examples/ndbapi_simple", "bin"], - "ndbapi_simple", NOT_REQUIRED); - - my $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; - $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log; - $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log; - } - # ---------------------------------------------------- # mysql clients # ---------------------------------------------------- @@ -2864,317 +2756,6 @@ sub vs_config_dirs ($$) { "$basedir/$path_part/debug/$exe"); } - -sub check_ndbcluster_support { - - my $ndbcluster_supported = 0; - if ($mysqld_variables{'ndb-connectstring'}) - { - $ndbcluster_supported = 1; - } - - if ($opt_skip_ndbcluster && $opt_include_ndbcluster) - { - # User is ambivalent. Theoretically the arg which was - # given last on command line should win, but that order is - # unknown at this time. - mtr_error("Ambigous command, both --include-ndbcluster " . - " and --skip-ndbcluster was specified"); - } - - # Check if this is MySQL Cluster, ie. mysql version string ends - # with -ndb-Y.Y.Y[-status] - if ( defined $mysql_version_extra && - $mysql_version_extra =~ /-ndb-([0-9]*)\.([0-9]*)\.([0-9]*)/ ) - { - # MySQL Cluster tree - mtr_report(" - MySQL Cluster detected"); - - if ($opt_skip_ndbcluster) - { - mtr_report(" - skipping ndbcluster(--skip-ndbcluster)"); - return; - } - - if (!$ndbcluster_supported) - { - # MySQL Cluster tree, but mysqld was not compiled with - # ndbcluster -> fail unless --skip-ndbcluster was used - mtr_error("This is MySQL Cluster but mysqld does not " . - "support ndbcluster. Use --skip-ndbcluster to " . - "force mtr to run without it."); - } - - # mysqld was compiled with ndbcluster -> auto enable - } - else - { - # Not a MySQL Cluster tree - if (!$ndbcluster_supported) - { - if ($opt_include_ndbcluster) - { - mtr_error("Could not detect ndbcluster support ". - "requested with --include-ndbcluster"); - } - - # Silently skip, mysqld was compiled without ndbcluster - # which is the default case - return; - } - - if ($opt_skip_ndbcluster) - { - # Compiled with ndbcluster but ndbcluster skipped - mtr_report(" - skipping ndbcluster(--skip-ndbcluster)"); - return; - } - - - # Not a MySQL Cluster tree, enable ndbcluster - # if --include-ndbcluster was used - if ($opt_include_ndbcluster) - { - # enable ndbcluster - } - else - { - mtr_report(" - skipping ndbcluster(disabled by default)"); - return; - } - } - - mtr_report(" - enabling ndbcluster"); - $ndbcluster_enabled= 1; - # Add MySQL Cluster test suites - push @DEFAULT_SUITES, qw(ndb ndb_binlog rpl_ndb ndb_rpl ndb_memcache); - return; -} - - -sub ndbcluster_wait_started { - my $cluster= shift; - my $ndb_waiter_extra_opt= shift; - my $path_waitlog= join('/', $opt_vardir, $cluster->name(), "ndb_waiter.log"); - - my $args; - mtr_init_args(\$args); - mtr_add_arg($args, "--defaults-file=%s", $path_config_file); - mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix()); - mtr_add_arg($args, "--timeout=%d", $opt_start_timeout); - - if ($ndb_waiter_extra_opt) - { - mtr_add_arg($args, "$ndb_waiter_extra_opt"); - } - - # Start the ndb_waiter which will connect to the ndb_mgmd - # and poll it for state of the ndbd's, will return when - # all nodes in the cluster is started - - my $res= My::SafeProcess->run - ( - name => "ndb_waiter ".$cluster->name(), - path => $exe_ndb_waiter, - args => \$args, - output => $path_waitlog, - error => $path_waitlog, - append => 1, - ); - - # Check that ndb_mgmd(s) are still alive - foreach my $ndb_mgmd ( in_cluster($cluster, ndb_mgmds()) ) - { - my $proc= $ndb_mgmd->{proc}; - if ( ! $proc->wait_one(0) ) - { - mtr_warning("$proc died"); - return 2; - } - } - - # Check that all started ndbd(s) are still alive - foreach my $ndbd ( in_cluster($cluster, ndbds()) ) - { - my $proc= $ndbd->{proc}; - next unless defined $proc; - if ( ! $proc->wait_one(0) ) - { - mtr_warning("$proc died"); - return 3; - } - } - - if ($res) - { - mtr_verbose("ndbcluster_wait_started failed"); - return 1; - } - return 0; -} - - -sub ndb_mgmd_wait_started($) { - my ($cluster)= @_; - - my $retries= 100; - while ($retries) - { - my $result= ndbcluster_wait_started($cluster, "--no-contact"); - if ($result == 0) - { - # ndb_mgmd is started - mtr_verbose("ndb_mgmd is started"); - return 0; - } - elsif ($result > 1) - { - mtr_warning("Cluster process failed while waiting for start"); - return $result; - } - - mtr_milli_sleep(100); - $retries--; - } - - return 1; -} - -sub ndb_mgmd_stop{ - my $ndb_mgmd= shift or die "usage: ndb_mgmd_stop()"; - - my $host=$ndb_mgmd->value('HostName'); - my $port=$ndb_mgmd->value('PortNumber'); - mtr_verbose("Stopping cluster '$host:$port'"); - - my $args; - mtr_init_args(\$args); - mtr_add_arg($args, "--ndb-connectstring=%s:%s", $host,$port); - mtr_add_arg($args, "-e"); - mtr_add_arg($args, "shutdown"); - - My::SafeProcess->run - ( - name => "ndb_mgm shutdown $host:$port", - path => $exe_ndb_mgm, - args => \$args, - output => "/dev/null", - ); -} - -sub ndb_mgmd_start ($$) { - my ($cluster, $ndb_mgmd)= @_; - - mtr_verbose("ndb_mgmd_start"); - - my $dir= $ndb_mgmd->value("DataDir"); - mkpath($dir) unless -d $dir; - - my $args; - mtr_init_args(\$args); - mtr_add_arg($args, "--defaults-file=%s", $path_config_file); - mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix()); - mtr_add_arg($args, "--mycnf"); - mtr_add_arg($args, "--nodaemon"); - - my $path_ndb_mgmd_log= "$dir/ndb_mgmd.log"; - - $ndb_mgmd->{'proc'}= My::SafeProcess->new - ( - name => $ndb_mgmd->after('cluster_config.'), - path => $exe_ndb_mgmd, - args => \$args, - output => $path_ndb_mgmd_log, - error => $path_ndb_mgmd_log, - append => 1, - verbose => $opt_verbose, - shutdown => sub { ndb_mgmd_stop($ndb_mgmd) }, - ); - mtr_verbose("Started $ndb_mgmd->{proc}"); - - # FIXME Should not be needed - # Unfortunately the cluster nodes will fail to start - # if ndb_mgmd has not started properly - if (ndb_mgmd_wait_started($cluster)) - { - mtr_warning("Failed to wait for start of ndb_mgmd"); - return 1; - } - - return 0; -} - -sub ndbd_stop { - # Intentionally left empty, ndbd nodes will be shutdown - # by sending "shutdown" to ndb_mgmd -} - -our $exe_ndbmtd_counter= 0; - -sub ndbd_start { - my ($cluster, $ndbd)= @_; - - mtr_verbose("ndbd_start"); - - my $dir= $ndbd->value("DataDir"); - mkpath($dir) unless -d $dir; - - my $args; - mtr_init_args(\$args); - mtr_add_arg($args, "--defaults-file=%s", $path_config_file); - mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix()); - mtr_add_arg($args, "--nodaemon"); - -# > 5.0 { 'character-sets-dir' => \&fix_charset_dir }, - - my $exe= $exe_ndbd; - if ($exe_ndbmtd and ($exe_ndbmtd_counter++ % 2) == 0) - { - # Use ndbmtd every other time - $exe= $exe_ndbmtd; - } - - my $path_ndbd_log= "$dir/ndbd.log"; - my $proc= My::SafeProcess->new - ( - name => $ndbd->after('cluster_config.'), - path => $exe, - args => \$args, - output => $path_ndbd_log, - error => $path_ndbd_log, - append => 1, - verbose => $opt_verbose, - shutdown => sub { ndbd_stop($ndbd) }, - ); - mtr_verbose("Started $proc"); - - $ndbd->{proc}= $proc; - - return; -} - - -sub ndbcluster_start ($) { - my ($cluster) = @_; - - mtr_verbose("ndbcluster_start '".$cluster->name()."'"); - - foreach my $ndb_mgmd ( in_cluster($cluster, ndb_mgmds()) ) - { - next if started($ndb_mgmd); - ndb_mgmd_start($cluster, $ndb_mgmd); - } - - foreach my $ndbd ( in_cluster($cluster, ndbds()) ) - { - next if started($ndbd); - ndbd_start($cluster, $ndbd); - } - - return 0; -} - - sub mysql_server_start($) { my ($mysqld, $tinfo) = @_; @@ -4109,8 +3690,6 @@ sub config_files($) { sub _like { return $config ? $config->like($_[0]) : (); } sub mysqlds { return _like('mysqld\.'); } -sub ndbds { return _like('cluster_config\.ndbd\.');} -sub ndb_mgmds { return _like('cluster_config\.ndb_mgmd\.'); } sub fix_servers($) { my ($tinfo) = @_; @@ -4121,19 +3700,6 @@ sub fix_servers($) { START => \&mysql_server_start, WAIT => \&mysql_server_wait, }, - qr/mysql_cluster\./ => { - SORT => 200, - START => \&ndbcluster_start, - WAIT => \&ndbcluster_wait_started, - }, - qr/cluster_config\.ndb_mgmd\./ => { - SORT => 210, - START => undef, - }, - qr/cluster_config\.ndbd\./ => { - SORT => 220, - START => undef, - }, $tinfo->{suite}->servers() ); for ($config->groups()) { @@ -4783,8 +4349,8 @@ sub extract_warning_lines ($$) { # Perl code. my @antipatterns = ( + @global_suppressions, qr/error .*connecting to master/, - qr/Plugin 'ndbcluster' will be forced to shutdown/, qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/, qr/InnoDB: Error: table `test`.`t[12]` .*does not exist in the InnoDB internal/, qr/InnoDB: Warning: Setting innodb_use_sys_malloc/, @@ -4798,7 +4364,6 @@ sub extract_warning_lines ($$) { qr/Now setting lower_case_table_names to [02]/, qr/Setting lower_case_table_names=2/, qr/You have forced lower_case_table_names to 0/, - qr/Plugin 'ndbcluster' will be forced to shutdow/, qr/deprecated/, qr/Slave SQL thread retried transaction/, qr/Slave \(additional info\)/, @@ -5668,18 +5233,6 @@ sub servers_need_restart($) { ############################################ -# -# Filter a list of servers and return only those that are part -# of the specified cluster -# -sub in_cluster { - my ($cluster)= shift; - # Return only processes for a specific cluster - return grep { $_->suffix() eq $cluster->suffix() } @_; -} - - - # # Filter a list of servers and return the SafeProcess # for only those that are started or stopped @@ -6393,9 +5946,6 @@ Options to control what test suites or cases to run the execution will continue from the next test file. When specified twice, execution will continue executing the failed test file from the next command. - with-ndbcluster-only Run only tests that include "ndb" in the filename - skip-ndb[cluster] Skip all tests that need cluster. Default. - include-ndb[cluster] Enable all tests that need cluster do-test=PREFIX or REGEX Run test cases which name are prefixed with PREFIX or fulfills REGEX diff --git a/mysql-test/r/analyze_stmt.result b/mysql-test/r/analyze_stmt.result index 53c3188cd4c..e5b3b804202 100644 --- a/mysql-test/r/analyze_stmt.result +++ b/mysql-test/r/analyze_stmt.result @@ -259,3 +259,20 @@ analyze delete from t1 returning *; id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 0 0 100.00 100.00 drop table t1; +# +# MDEV-6396: ANALYZE INSERT/REPLACE is accepted, but does not produce a plan +# +create table t1 (a int primary key, b int); +analyze insert into t1 values (1,1); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +select * from t1; +a b +1 1 +analyze replace t1 values (1,2); +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 INSERT t1 ALL NULL NULL NULL NULL NULL NULL 100.00 100.00 NULL +select * from t1; +a b +1 2 +drop table t1; diff --git a/mysql-test/r/compound.result b/mysql-test/r/compound.result new file mode 100644 index 00000000000..76aa3831553 --- /dev/null +++ b/mysql-test/r/compound.result @@ -0,0 +1,174 @@ +CREATE TABLE t1 (a INT PRIMARY KEY)| +BEGIN NOT ATOMIC +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +END| +SELECT * FROM t1| +a +1 +2 +3 +PREPARE stmt FROM "BEGIN NOT ATOMIC + INSERT INTO t1 VALUES (4); + INSERT INTO t1 VALUES (5); + INSERT INTO t1 VALUES (?); +END"; +SET @val = 6| +reset master| +EXECUTE stmt USING @val| +SELECT * FROM t1| +a +1 +2 +3 +4 +5 +6 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +master-bin.000001 # Query # # COMMIT +PREPARE stmt FROM "BEGIN NOT ATOMIC + DECLARE v_res INT; + SELECT COUNT(*) INTO v_res FROM t1; + SELECT 'Hello World', v_res INTO ?,?; +END"| +SET @val="", @val2=""| +EXECUTE stmt USING @val, @val2| +SELECT @val, @val2| +@val @val2 +Hello World 6 +DROP TABLE t1| +CREATE DATABASE mysqltest1| +CREATE PROCEDURE mysqltest1.sp1() +BEGIN +PREPARE stmt FROM "BEGIN NOT ATOMIC CREATE TABLE t1 AS SELECT DATABASE(); END"; +EXECUTE stmt; +END| +CALL mysqltest1.sp1()| +SELECT * FROM mysqltest1.t1| +DATABASE() +mysqltest1 +USE mysqltest1| +DROP DATABASE mysqltest1| +BEGIN NOT ATOMIC CREATE TABLE t1(a int); END| +ERROR 3D000: No database selected +BEGIN NOT ATOMIC SET @a=1; CREATE TABLE test.t1(a int); END| +USE test| +show tables| +Tables_in_test +t1 +drop table t1| +/**/ if (select count(*) from information_schema.tables +where table_schema='test' and table_name='t1') = 0 +then +create table t1 (a int); +end if| +show tables| +Tables_in_test +t1 +/**/ if (select count(*) from information_schema.tables +where table_schema='test' and table_name='t1') = 0 +then +create table t1 (a int); +end if| +show tables| +Tables_in_test +t1 +case (select table_name from information_schema.tables where table_schema='test') +when 't1' then create table t2 (b int); +when 't2' then create table t3 (b int); +else signal sqlstate '42S02'; +end case| +show tables| +Tables_in_test +t1 +t2 +case +when database() = 'test' then create table t3 (test text); +when now() < date'2001-02-03' then create table oops (machine time); +end case| +show tables| +Tables_in_test +t1 +t2 +t3 +loop +create table t4 (a int); +end loop| +ERROR 42S01: Table 't4' already exists +show tables| +Tables_in_test +t1 +t2 +t3 +t4 +set @a=0; +repeat +set @a = @a + 1; +until @a > 5 +end repeat| +select @a| +@a +6 +/**/ while (select count(*) from information_schema.tables where table_schema='test') +do +select concat('drop table ', table_name) into @a +from information_schema.tables where table_schema='test' limit 1; +select @a as 'executing:'; +prepare dt from @a; +execute dt; +end while| +executing: drop table t1 +executing: drop table t2 +executing: drop table t3 +executing: drop table t4 +create table t1 (x int)| +create function fn(a int) returns int +begin +insert t1 values (a+7); +return a+8; +end| +reset master| +/**/ if fn(9) > 5 then +select 1; +end if| +1 +1 +prepare stmt from "if fn(?) > 6 then + begin + declare a int; + set a=?*2; + insert t1 values(a+?); + end; +end if"| +set @a=1, @b=2, @c=3| +execute stmt using @a, @b, @c| +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fn`(9) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fn`(1) +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; insert t1 values( NAME_CONST('a',4)+3) +master-bin.000001 # Query # # COMMIT +drop function fn| +drop table t1| +begin not atomic select @@sql_mode; end| +@@sql_mode + +create table t1 (a int)| +select a from t1 having a > 1| +a +begin not atomic select a from t1 having a > 1; end| +a +drop table t1| diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result index 063cec289ab..52c2406ae4d 100644 --- a/mysql-test/r/ctype_cp1250_ch.result +++ b/mysql-test/r/ctype_cp1250_ch.result @@ -351,7 +351,7 @@ a DROP TABLE t1; set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators) using cp1250); -ERROR HY000: Unknown locale: '1' +ERROR HY000: Unknown locale: 'ON' # # Start of 5.6 tests # diff --git a/mysql-test/r/galera_sst_mode.result b/mysql-test/r/galera_sst_mode.result new file mode 100644 index 00000000000..ea25b322449 --- /dev/null +++ b/mysql-test/r/galera_sst_mode.result @@ -0,0 +1,24 @@ +# +# Test for mysqldump's galera-sst-mode option +# +# +# MDEV-6490: mysqldump unknown option --galera-sst-mode +# +CREATE DATABASE bug6490; +USE bug6490; +CREATE TABLE t1(c1 INT); +INSERT INTO t1 values (1); +INSERT INTO t1 values (2); +# Save the current gtid_binlog_state. +# Take a dump of bug6490 database +DROP TABLE t1; +# Load the dump +RESET MASTER; +SELECT * from t1; +c1 +1 +2 +# Compare the two gtid_binlog_state's +# Cleanup +DROP DATABASE bug6490; +# End of test diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 25fe976b7ed..6c769e60780 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -58,6 +58,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA' @@ -85,7 +86,7 @@ delete from mysql.user where user='mysqltest_1'; flush privileges; delete from mysql.user where user='mysqltest_1'; flush privileges; -grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10; +grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10 max_statement_time 60; select * from mysql.user where user="mysqltest_1"; Host localhost User mysqltest_1 @@ -132,10 +133,11 @@ authentication_string password_expired N is_role N default_role +max_statement_time 60.000000 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost -GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 -grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30; +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_STATEMENT_TIME 60.000000 +grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30 max_statement_time 0; select * from mysql.user where user="mysqltest_1"; Host localhost User mysqltest_1 @@ -182,6 +184,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30 diff --git a/mysql-test/r/handlersocket.result b/mysql-test/r/handlersocket.result index b519e2e7c93..2332a8b2c7f 100644 --- a/mysql-test/r/handlersocket.result +++ b/mysql-test/r/handlersocket.result @@ -5,7 +5,7 @@ plugin_version 1.0 plugin_status ACTIVE plugin_type DAEMON plugin_library handlersocket.so -plugin_library_version 1.8 +plugin_library_version 1.10 plugin_author higuchi dot akira at dena dot jp plugin_description Direct access into InnoDB plugin_license BSD diff --git a/mysql-test/r/have_mutex_deadlock_detector.require b/mysql-test/r/have_mutex_deadlock_detector.require deleted file mode 100644 index 6ed281c757a..00000000000 --- a/mysql-test/r/have_mutex_deadlock_detector.require +++ /dev/null @@ -1,2 +0,0 @@ -1 -1 diff --git a/mysql-test/r/have_ndb_extra.require b/mysql-test/r/have_ndb_extra.require deleted file mode 100644 index 8f7c125196a..00000000000 --- a/mysql-test/r/have_ndb_extra.require +++ /dev/null @@ -1,3 +0,0 @@ -select 1; -1 -1 diff --git a/mysql-test/r/have_ndbapi_examples.require b/mysql-test/r/have_ndbapi_examples.require deleted file mode 100644 index 924d2d51708..00000000000 --- a/mysql-test/r/have_ndbapi_examples.require +++ /dev/null @@ -1,2 +0,0 @@ -have_ndb_example -1 diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index c907997573a..9820170aa59 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 17 Using sort_union(i1,i2); Using where explain select * from t0 where key2 = 45 or key1 <=> null; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using where +1 SIMPLE t0 range i1,i2 i2 4 NULL 1 Using index condition explain select * from t0 where key2 = 45 or key1 is not null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL i1,i2 NULL NULL NULL 1024 Using where diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result index 9bf015d1b37..a138de42ae9 100644 --- a/mysql-test/r/information_schema-big.result +++ b/mysql-test/r/information_schema-big.result @@ -48,6 +48,7 @@ SCHEMA_PRIVILEGES TABLE_SCHEMA SESSION_STATUS VARIABLE_NAME SESSION_VARIABLES VARIABLE_NAME STATISTICS TABLE_SCHEMA +SYSTEM_VARIABLES VARIABLE_NAME TABLES TABLE_SCHEMA TABLESPACES TABLESPACE_NAME TABLE_CONSTRAINTS CONSTRAINT_SCHEMA @@ -102,6 +103,7 @@ SCHEMA_PRIVILEGES TABLE_SCHEMA SESSION_STATUS VARIABLE_NAME SESSION_VARIABLES VARIABLE_NAME STATISTICS TABLE_SCHEMA +SYSTEM_VARIABLES VARIABLE_NAME TABLES TABLE_SCHEMA TABLESPACES TABLESPACE_NAME TABLE_CONSTRAINTS CONSTRAINT_SCHEMA diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 6df5b890217..3d261d0be5f 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -42,7 +42,7 @@ insert into t5 values (10); create view v1 (c) as SELECT table_name FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND -table_name not like 'ndb_%' AND table_name not like 'innodb_%' AND +table_name not like 'innodb_%' AND table_name not like 'xtradb_%'; select * from v1; c @@ -75,6 +75,7 @@ SCHEMA_PRIVILEGES SESSION_STATUS SESSION_VARIABLES STATISTICS +SYSTEM_VARIABLES TABLES TABLESPACES TABLE_CONSTRAINTS @@ -128,6 +129,11 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_PRIVILEGES TABLE_PRIVILEGES TABLE_STATISTICS TABLE_STATISTICS TRIGGERS TRIGGERS +t1 t1 +t2 t2 +t3 t3 +t4 t4 +t5 t5 table_stats table_stats tables_priv tables_priv time_zone time_zone @@ -135,11 +141,6 @@ time_zone_leap_second time_zone_leap_second time_zone_name time_zone_name time_zone_transition time_zone_transition time_zone_transition_type time_zone_transition_type -t1 t1 -t4 t4 -t2 t2 -t3 t3 -t5 t5 select c,table_name from v1 left join information_schema.TABLES v2 on (v1.c=v2.table_name) where v1.c like "t%"; @@ -150,6 +151,11 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_PRIVILEGES TABLE_PRIVILEGES TABLE_STATISTICS TABLE_STATISTICS TRIGGERS TRIGGERS +t1 t1 +t2 t2 +t3 t3 +t4 t4 +t5 t5 table_stats table_stats tables_priv tables_priv time_zone time_zone @@ -157,11 +163,6 @@ time_zone_leap_second time_zone_leap_second time_zone_name time_zone_name time_zone_transition time_zone_transition time_zone_transition_type time_zone_transition_type -t1 t1 -t4 t4 -t2 t2 -t3 t3 -t5 t5 select c, v2.table_name from v1 right join information_schema.TABLES v2 on (v1.c=v2.table_name) where v1.c like "t%"; @@ -172,6 +173,11 @@ TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_PRIVILEGES TABLE_PRIVILEGES TABLE_STATISTICS TABLE_STATISTICS TRIGGERS TRIGGERS +t1 t1 +t2 t2 +t3 t3 +t4 t4 +t5 t5 table_stats table_stats tables_priv tables_priv time_zone time_zone @@ -179,11 +185,6 @@ time_zone_leap_second time_zone_leap_second time_zone_name time_zone_name time_zone_transition time_zone_transition time_zone_transition_type time_zone_transition_type -t1 t1 -t4 t4 -t2 t2 -t3 t3 -t5 t5 select table_name from information_schema.TABLES where table_schema = "mysqltest" and table_name like "t%"; table_name @@ -819,6 +820,7 @@ information_schema PROCESSLIST INFO information_schema ROUTINES DTD_IDENTIFIER information_schema ROUTINES ROUTINE_DEFINITION information_schema ROUTINES ROUTINE_COMMENT +information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_STATEMENT information_schema VIEWS VIEW_DEFINITION @@ -1637,6 +1639,33 @@ drop table if exists t1;drop table if exists t1; drop table if exists t1;drop table if exists Warnings: Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row 1 +select * from information_schema.global_variables where variable_name like 'init%' order by variable_name; +VARIABLE_NAME VARIABLE_VALUE +INIT_CONNECT drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists t1; +drop table if exists t1;drop table if exists +INIT_FILE +INIT_SLAVE +Warnings: +Warning 1265 Data truncated for column 'VARIABLE_VALUE' at row # set global init_connect=""; create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT'; SELECT 1; diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result index 7e6cfd176a4..58ac182f3a4 100644 --- a/mysql-test/r/information_schema_all_engines.result +++ b/mysql-test/r/information_schema_all_engines.result @@ -46,6 +46,7 @@ SCHEMA_PRIVILEGES SESSION_STATUS SESSION_VARIABLES STATISTICS +SYSTEM_VARIABLES TABLES TABLESPACES TABLE_CONSTRAINTS @@ -115,6 +116,7 @@ SCHEMA_PRIVILEGES TABLE_SCHEMA SESSION_STATUS VARIABLE_NAME SESSION_VARIABLES VARIABLE_NAME STATISTICS TABLE_SCHEMA +SYSTEM_VARIABLES VARIABLE_NAME TABLES TABLE_SCHEMA TABLESPACES TABLESPACE_NAME TABLE_CONSTRAINTS CONSTRAINT_SCHEMA @@ -184,6 +186,7 @@ SCHEMA_PRIVILEGES TABLE_SCHEMA SESSION_STATUS VARIABLE_NAME SESSION_VARIABLES VARIABLE_NAME STATISTICS TABLE_SCHEMA +SYSTEM_VARIABLES VARIABLE_NAME TABLES TABLE_SCHEMA TABLESPACES TABLESPACE_NAME TABLE_CONSTRAINTS CONSTRAINT_SCHEMA @@ -258,6 +261,7 @@ SCHEMA_PRIVILEGES information_schema.SCHEMA_PRIVILEGES 1 SESSION_STATUS information_schema.SESSION_STATUS 1 SESSION_VARIABLES information_schema.SESSION_VARIABLES 1 STATISTICS information_schema.STATISTICS 1 +SYSTEM_VARIABLES information_schema.SYSTEM_VARIABLES 1 TABLES information_schema.TABLES 1 TABLESPACES information_schema.TABLESPACES 1 TABLE_CONSTRAINTS information_schema.TABLE_CONSTRAINTS 1 @@ -317,6 +321,7 @@ Database: information_schema | SESSION_STATUS | | SESSION_VARIABLES | | STATISTICS | +| SYSTEM_VARIABLES | | TABLES | | TABLESPACES | | TABLE_CONSTRAINTS | @@ -376,6 +381,7 @@ Database: INFORMATION_SCHEMA | SESSION_STATUS | | SESSION_VARIABLES | | STATISTICS | +| SYSTEM_VARIABLES | | TABLES | | TABLESPACES | | TABLE_CONSTRAINTS | @@ -391,7 +397,7 @@ Database: INFORMATION_SCHEMA Wildcard: inf_rmation_schema | Databases | | information_schema | -SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; +SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA; table_schema count(*) -information_schema 54 +information_schema 55 mysql 30 diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result index 9140f306f77..cae402a9f12 100644 --- a/mysql-test/r/innodb_ext_key.result +++ b/mysql-test/r/innodb_ext_key.result @@ -1002,7 +1002,7 @@ insert into t2 (b) values (null), (null), (null); set optimizer_switch='extended_keys=on'; explain select a from t1 where b is null order by a desc limit 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref b b 9 const 2 Using where; Using filesort +1 SIMPLE t1 index b PRIMARY 8 NULL 3 Using where select a from t1 where b is null order by a desc limit 2; a 3 diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index e303c288552..36c2f1898f8 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -2090,10 +2090,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; @@ -2222,4 +2222,32 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`)) DROP TABLE t1,t2,t3; +# +# MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(b), key(c)); +insert into t2 select +@a:=A.a + 10*B.a+100*C.a, +IF(@a<900, NULL, @a), +IF(@a<500, NULL, @a) +from t1 A, t1 B, t1 C; +delete from t1 where a=0; +# Check that there are different #rows of NULLs for b and c, both !=10: +explain select * from t2 force index (b) where b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref b b 5 const 780 Using index condition +explain select * from t2 force index (c) where c is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c c 5 const 393 Using index condition +explain select * from t1 left join t2 on t2.b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 ref b b 5 const 780 Using where +explain select * from t1 left join t2 on t2.c is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 ref c c 5 const 393 Using where +drop table t1,t2; SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 88f2fd7c630..6f3da3efdd7 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -2101,10 +2101,10 @@ SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where; Using filesort +1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where 1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Warnings: -Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (((`test`.`t1`.`pk` between 5 and 6) and isnull(`test`.`t1`.`b`)) or (`test`.`t1`.`b` = 5))) order by `test`.`t1`.`b` +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where ((`test`.`t2`.`c` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = 5)) order by `test`.`t1`.`b` SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5 ORDER BY t1.b; @@ -2233,6 +2233,34 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`)) DROP TABLE t1,t2,t3; +# +# MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(b), key(c)); +insert into t2 select +@a:=A.a + 10*B.a+100*C.a, +IF(@a<900, NULL, @a), +IF(@a<500, NULL, @a) +from t1 A, t1 B, t1 C; +delete from t1 where a=0; +# Check that there are different #rows of NULLs for b and c, both !=10: +explain select * from t2 force index (b) where b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref b b 5 const 780 Using index condition +explain select * from t2 force index (c) where c is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref c c 5 const 393 Using index condition +explain select * from t1 left join t2 on t2.b is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 ref b b 5 const 780 Using where +explain select * from t1 left join t2 on t2.c is null; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 +1 SIMPLE t2 ref c c 5 const 393 Using where +drop table t1,t2; SET optimizer_switch=@save_optimizer_switch; set join_cache_level=default; show variables like 'join_cache_level'; diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index cc6f3709ae4..f157887de4b 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -42,6 +42,7 @@ select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id # Switch to connection default set global slow_query_log= ON; +set local slow_query_log= ON; # Switch to connection con1 set session long_query_time = @long_query_time; select sleep(@long_query_time + 1); @@ -49,7 +50,13 @@ sleep(@long_query_time + 1) 0 select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id -TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 1) THREAD_ID +set local slow_query_log= ON; +select sleep(@long_query_time + 2); +sleep(@long_query_time + 2) +0 +select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%'; +start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id +TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 select sleep(@long_query_time + 2) THREAD_ID # Switch to connection default show global variables where Variable_name = 'general_log' or Variable_name = 'slow_query_log'; @@ -62,6 +69,7 @@ set global general_log= OFF; set global slow_query_log= ON; set global slow_query_log= OFF; set global slow_query_log= OFF; +set local slow_query_log= ON; set global general_log= ON; truncate table mysql.general_log; create table t1(f1 int); @@ -124,6 +132,9 @@ Variable_name Value general_log OFF show variables like 'slow_query_log'; Variable_name Value +slow_query_log ON +show global variables like 'slow_query_log'; +Variable_name Value slow_query_log OFF set global general_log=ON; set global log_output=default; diff --git a/mysql-test/r/max_statement_time.result b/mysql-test/r/max_statement_time.result new file mode 100644 index 00000000000..2681575daea --- /dev/null +++ b/mysql-test/r/max_statement_time.result @@ -0,0 +1,147 @@ + +# Test the MAX_STATEMENT_TIME option. + +SET @@MAX_STATEMENT_TIME=2; +select @@max_statement_time; +@@max_statement_time +2.000000 +SELECT SLEEP(1); +SLEEP(1) +0 +SELECT SLEEP(3); +SLEEP(3) +1 +SET @@MAX_STATEMENT_TIME=0; +SELECT SLEEP(1); +SLEEP(1) +0 +SHOW STATUS LIKE "max_statement_time_exceeded"; +Variable_name Value +Max_statement_time_exceeded 1 +CREATE TABLE t1 (a INT, b VARCHAR(300)) engine=myisam; +INSERT INTO t1 VALUES (1, 'string'); +SELECT 0; +0 +0 + +# Test the MAX_STATEMENT_TIME option with SF (should have no effect). + +CREATE PROCEDURE p1() +BEGIN +declare tmp int; +SET @@MAX_STATEMENT_TIME=0.0001; +SELECT COUNT(*) INTO tmp FROM t1 WHERE b LIKE '%z%'; +SET @@MAX_STATEMENT_TIME=0; +END| +CREATE PROCEDURE p2() +BEGIN +SET @@MAX_STATEMENT_TIME=5; +END| +SELECT @@MAX_STATEMENT_TIME; +@@MAX_STATEMENT_TIME +0.000000 +CALL p1(); +CALL p2(); +SELECT @@MAX_STATEMENT_TIME; +@@MAX_STATEMENT_TIME +5.000000 +SET @@MAX_STATEMENT_TIME=0; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; + +# MAX_STATEMENT_TIME account resource + +GRANT USAGE ON *.* TO user1@localhost WITH MAX_STATEMENT_TIME 1.005; +# con1 +SELECT @@max_statement_time; +@@max_statement_time +1.005000 +# restart and reconnect +set @global.userstat=1; +SELECT @@global.max_statement_time,@@session.max_statement_time; +@@global.max_statement_time @@session.max_statement_time +0.000000 1.005000 +select sleep(100); +sleep(100) +1 +SHOW STATUS LIKE "max_statement_time_exceeded"; +Variable_name Value +Max_statement_time_exceeded 1 +show grants for user1@localhost; +Grants for user1@localhost +GRANT USAGE ON *.* TO 'user1'@'localhost' WITH MAX_STATEMENT_TIME 1.005000 +set @global.userstat=0; +DROP USER user1@localhost; + +# MAX_STATEMENT_TIME status variables. + +flush status; +SET @@max_statement_time=0; +SELECT CONVERT(VARIABLE_VALUE, UNSIGNED) INTO @time_exceeded +FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME = 'max_statement_time_exceeded'; +SET @@max_statement_time=0.5; +SELECT SLEEP(2); +SLEEP(2) +1 +SHOW STATUS LIKE '%timeout%'; +Variable_name Value +Ssl_default_timeout 0 +Ssl_session_cache_timeouts 0 +SET @@max_statement_time=0; +# Ensure that the counters for: +# - statements that exceeded their maximum execution time +# are incremented. +SELECT 1 AS STATUS FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME = 'max_statement_time_exceeded' + AND CONVERT(VARIABLE_VALUE, UNSIGNED) > @time_exceeded; +STATUS +1 + +# Check that the appropriate error status is set. + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +START TRANSACTION; +SELECT * FROM t1 FOR UPDATE; +a +1 +SET @@SESSION.max_statement_time = 0.5; +UPDATE t1 SET a = 2; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +SHOW WARNINGS; +Level Code Message +Error 1967 Query execution was interrupted (max_statement_time exceeded) +ROLLBACK; +DROP TABLE t1; + +# Test interaction with lock waits. + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET @@SESSION.max_statement_time= 0.5; +LOCK TABLES t1 WRITE; +SELECT @@SESSION.max_statement_time; +@@SESSION.max_statement_time +0.500000 +LOCK TABLES t1 READ; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +UNLOCK TABLES; +BEGIN; +SELECT * FROM t1; +a +1 +ALTER TABLE t1 ADD COLUMN b INT; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +ROLLBACK; +SELECT GET_LOCK('lock', 1); +GET_LOCK('lock', 1) +1 +SELECT GET_LOCK('lock', 1); +GET_LOCK('lock', 1) +NULL +SELECT RELEASE_LOCK('lock'); +RELEASE_LOCK('lock') +1 +DROP TABLE t1; diff --git a/mysql-test/r/myisam_explain_non_select_all.result b/mysql-test/r/myisam_explain_non_select_all.result index 285a1ca6786..a9eeee8548c 100644 --- a/mysql-test/r/myisam_explain_non_select_all.result +++ b/mysql-test/r/myisam_explain_non_select_all.result @@ -674,14 +674,14 @@ FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > 0) order by `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_first 1 +Handler_read_key 1 Handler_read_next 3 # Status of testing query execution: Variable_name Value diff --git a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result index dda732937ee..c00a0c73ce3 100644 --- a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result @@ -2,6 +2,9 @@ # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above # # Verbose run +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -25,7 +28,11 @@ Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zo Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; +set @toggle=0; execute set_wsrep_myisam using @toggle; # Silent run +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; @@ -46,17 +53,26 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; +set @toggle=0; execute set_wsrep_myisam using @toggle; # # Testing with explicit timezonefile # +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id); INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (@time_zone_id, 0, 0, 0, 'GMT') ; +set @toggle=0; execute set_wsrep_myisam using @toggle; # # Testing --leap # +set @prep=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET GLOBAL wsrep_replicate_myisam=?', 'do ?'); +prepare set_wsrep_myisam from @prep; +set @toggle=1; execute set_wsrep_myisam using @toggle; TRUNCATE TABLE time_zone_leap_second; ALTER TABLE time_zone_leap_second ORDER BY Transition_time; +set @toggle=0; execute set_wsrep_myisam using @toggle; diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index 5a2142c402c..0d7e2240769 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -412,7 +412,7 @@ The following options may be given as the first argument: Maximum number of prepared statements in the server --max-relay-log-size=# relay log will be rotated automatically when the size - exceeds this value. If 0 are startup, it's set to + exceeds this value. If 0 at startup, it's set to max_binlog_size --max-seeks-for-key=# Limit assumed max number of seeks when looking up rows @@ -422,6 +422,11 @@ The following options may be given as the first argument: value are used; the rest are ignored) --max-sp-recursion-depth[=#] Maximum stored procedure recursion depth + --max-statement-time=# + A SELECT query that have taken more than + max_statement_time seconds will be aborted. The argument + will be treated as a decimal value with microsecond + precision. A value of 0 (default) means no timeout --max-tmp-tables=# Maximum number of temporary tables a client can keep open at a time --max-user-connections=# @@ -1196,6 +1201,7 @@ max-relay-log-size 1073741824 max-seeks-for-key 18446744073709551615 max-sort-length 1024 max-sp-recursion-depth 0 +max-statement-time 0 max-tmp-tables 32 max-user-connections 0 max-write-lock-count 18446744073709551615 @@ -1263,7 +1269,7 @@ performance-schema-max-rwlock-instances -1 performance-schema-max-socket-classes 10 performance-schema-max-socket-instances -1 performance-schema-max-stage-classes 150 -performance-schema-max-statement-classes 180 +performance-schema-max-statement-classes 178 performance-schema-max-table-handles -1 performance-schema-max-table-instances -1 performance-schema-max-thread-classes 50 diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 4b0b3faf629..a7ef5d4d92f 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -5290,3 +5290,13 @@ Usage: mysqldump [OPTIONS] database [tables] OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] OR mysqldump [OPTIONS] --all-databases [OPTIONS] For more options, use mysqldump --help +# +# Test mysqldump with --disable-query-logs +# +create table t1 (a int); +insert into t1 values (1); +drop table t1; +select * from t1; +a +1 +drop table t1; diff --git a/mysql-test/r/ndb_default_cluster.require b/mysql-test/r/ndb_default_cluster.require deleted file mode 100644 index 3616ae0f343..00000000000 --- a/mysql-test/r/ndb_default_cluster.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -Ndb_config_from_host localhost diff --git a/mysql-test/r/not_ndb.require b/mysql-test/r/not_ndb.require deleted file mode 100644 index 36fcf7958d4..00000000000 --- a/mysql-test/r/not_ndb.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -have_ndbcluster NO diff --git a/mysql-test/r/not_ndb_default.require b/mysql-test/r/not_ndb_default.require deleted file mode 100644 index 09aae1ed1d0..00000000000 --- a/mysql-test/r/not_ndb_default.require +++ /dev/null @@ -1,2 +0,0 @@ -TRUE -1 diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 294142737d9..d5b25534de0 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -297,7 +297,7 @@ create table t1 (a int not null, b int, c varchar(10), key (a, b, c)); insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b'); explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index a a 22 NULL 11 Using where; Using index +1 SIMPLE t1 range a a 22 NULL 2 Using where; Using index select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc; a b c 1 NULL b @@ -2569,7 +2569,7 @@ SELECT * FROM t1 r JOIN t1 s ON r.a = s.a WHERE s.a IN (2,9) OR s.a < 100 AND s.a != 0 ORDER BY 1 LIMIT 10; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE r index PRIMARY PRIMARY 4 NULL 10 100.00 Using where; Using index +1 SIMPLE r range PRIMARY PRIMARY 4 NULL 12 100.00 Using where; Using index 1 SIMPLE s eq_ref PRIMARY PRIMARY 4 test.r.a 1 100.00 Using index Warnings: Note 1003 select `test`.`r`.`a` AS `a`,`test`.`s`.`a` AS `a` from `test`.`t1` `r` join `test`.`t1` `s` where ((`test`.`s`.`a` = `test`.`r`.`a`) and ((`test`.`r`.`a` in (2,9)) or ((`test`.`r`.`a` < 100) and (`test`.`r`.`a` <> 0)))) order by 1 limit 10 @@ -2600,7 +2600,7 @@ CREATE TABLE t1 (a INT,KEY (a)); INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); EXPLAIN SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index a a 5 NULL 10 Using where; Using index; Using filesort +1 SIMPLE t1 range a a 5 NULL 10 Using where; Using index SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC; a 1 10 1 @@ -2949,3 +2949,39 @@ explain update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 li id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range key1 key1 5 NULL 2 Using where; Using buffer drop table t1,t2; +# +# MDEV-465: Optimizer : wrong index choice, leading to strong performances issues +# +CREATE TABLE t1 ( +id1 int(10) unsigned NOT NULL auto_increment, +id2 tinyint(3) unsigned NOT NULL default '0', +id3 tinyint(3) unsigned NOT NULL default '0', +id4 int(10) unsigned NOT NULL default '0', +date timestamp NOT NULL default CURRENT_TIMESTAMP, +PRIMARY KEY (id1), +KEY id_234_date (id2,id3,id4,date), +KEY id_23_date (id2,id3,date) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +# t1 has "bad" index declaration order.. +CREATE TABLE t2 ( +id1 int(10) unsigned NOT NULL auto_increment, +id2 tinyint(3) unsigned NOT NULL default '0', +id3 tinyint(3) unsigned NOT NULL default '0', +id4 int(10) unsigned NOT NULL default '0', +date timestamp NOT NULL default CURRENT_TIMESTAMP, +PRIMARY KEY (id1), +KEY id_23_date (id2,id3,date), +KEY id_234_date (id2,id3,id4,date) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +# t2 has a "good" index declaration order +INSERT INTO t1 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); +INSERT INTO t2 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1); +# The following two must both use id_23_date and no "using filesort": +EXPLAIN SELECT id1 FROM t1 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range id_234_date,id_23_date id_23_date 2 NULL 3 Using where +# See above query +EXPLAIN SELECT id1 FROM t2 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref id_23_date,id_234_date id_23_date 2 const,const 3 Using where +drop table t1,t2; diff --git a/mysql-test/r/order_by_optimizer_innodb.result b/mysql-test/r/order_by_optimizer_innodb.result new file mode 100644 index 00000000000..f3167db4b9a --- /dev/null +++ b/mysql-test/r/order_by_optimizer_innodb.result @@ -0,0 +1,98 @@ +drop table if exists t0,t1,t2,t3; +# +# MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +CREATE TABLE t2 ( +pk1 int(11) NOT NULL, +pk2 int(11) NOT NULL, +fd5 bigint(20) DEFAULT NULL, +filler1 char(200), +filler2 char(200), +PRIMARY KEY (pk1,pk2), +UNIQUE KEY ux_pk1_fd5 (pk1,fd5) +) ENGINE=InnoDB; +insert into t2 +select +round(log(2,t1.a+1)), +t1.a, +t1.a, +REPEAT('filler-data-', 10), +REPEAT('filler-data-', 10) +from +t1; +select pk1, count(*) from t2 group by pk1; +pk1 count(*) +0 1 +1 1 +2 3 +3 6 +4 11 +5 23 +6 45 +7 91 +8 181 +9 362 +10 276 +# The following should use range(ux_pk1_fd5), two key parts (key_len=5+8=13) +EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range ux_pk1_fd5 ux_pk1_fd5 13 NULL 137 Using where +# This also must use range, not ref. key_len must be 13 +EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 137 Using where +drop table t0,t1, t2; +# +# MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY +# +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY(f2),KEY(f2,f1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,5,0),(2,6,0); +SELECT * FROM t1 WHERE f1 < 3 AND f2 IS NULL ORDER BY f1; +f1 f2 f3 +DROP TABLE t1; +# +# MDEV-6796: Unable to skip filesort when using implicit extended key +# +CREATE TABLE t1 ( +pk1 int(11) NOT NULL, +pk2 varchar(64) NOT NULL, +col1 varchar(16) DEFAULT NULL, +PRIMARY KEY (pk1,pk2), +KEY key1 (pk1,col1) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2 ( +pk1 int(11) NOT NULL, +pk2 varchar(64) NOT NULL, +col1 varchar(16) DEFAULT NULL, +PRIMARY KEY (pk1,pk2), +KEY key1 (pk1,col1,pk2) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `t1` VALUES +(12321321,'a8f5f167f44f4964e6c998dee827110c','video'), +(12321321,'d77a17a3659ffa60c54e0ea17b6c6d16','video'), +(12321321,'wwafdsafdsafads','video'), +(12321321,'696aa249f0738e8181957dd57c2d7d0b','video-2014-09-23'), +(12321321,'802f9f29584b486f356693e3aa4ef0af','video=sdsd'), +(12321321,'2f94543ff74aab82e9a058b4e8316d75','video=sdsdsds'), +(12321321,'c1316b9df0d203fd1b9035308de52a0a','video=sdsdsdsdsd'); +insert into t2 select * from t1; +# this must not use filesort: +explain SELECT pk2 +FROM t1 USE INDEX(key1) +WHERE pk1 = 123 +AND col1 = 'video' +ORDER BY pk2 DESC LIMIT 21; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref key1 key1 55 const,const 1 Using where; Using index +# this must not use filesort, either: +explain SELECT pk2 +FROM t2 USE INDEX(key1) +WHERE pk1 = 123 AND col1 = 'video' +ORDER BY pk2 DESC LIMIT 21; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref key1 key1 55 const,const 1 Using where; Using index +drop table t1, t2; diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index 630f0141d18..d9838175349 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -15,7 +15,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.8 +PLUGIN_LIBRARY_VERSION 1.10 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL @@ -28,7 +28,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE DAEMON PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.8 +PLUGIN_LIBRARY_VERSION 1.10 PLUGIN_AUTHOR Sergei Golubchik PLUGIN_DESCRIPTION Unusable Daemon PLUGIN_LICENSE GPL @@ -67,7 +67,7 @@ PLUGIN_STATUS DELETED PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.8 +PLUGIN_LIBRARY_VERSION 1.10 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 7db51eadbe6..e30fa9a1966 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1202,13 +1202,13 @@ SET @aux= "SELECT COUNT(*) prepare my_stmt from @aux; execute my_stmt; COUNT(*) -45 +46 execute my_stmt; COUNT(*) -45 +46 execute my_stmt; COUNT(*) -45 +46 deallocate prepare my_stmt; drop procedure if exists p1| drop table if exists t1| diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 6ca76191db5..75a6b669a40 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -2265,7 +2265,46 @@ def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +execute stmt1 using @result; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 8 20 1 Y 32896 0 63 +def @arg02 8 20 0 Y 32896 0 63 +def @arg03 8 20 0 Y 32896 0 63 +def @arg04 8 20 0 Y 32896 0 63 +def @arg05 8 20 0 Y 32896 0 63 +def @arg06 8 20 0 Y 32896 0 63 +def @arg07 5 23 0 Y 32896 31 63 +def @arg08 5 23 0 Y 32896 31 63 +def @arg09 5 23 0 Y 32896 31 63 +def @arg10 5 23 0 Y 32896 31 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 +def @arg17 8 20 0 Y 32928 0 63 +def @arg18 8 20 0 Y 32896 0 63 +def @arg19 8 20 0 Y 32896 0 63 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +select @result; +@result +1 test_sequence -- insert into numeric columns -- insert into t9 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 47237790ae5..17be5e53418 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -2248,7 +2248,46 @@ def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +execute stmt1 using @result; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 8 20 1 Y 32896 0 63 +def @arg02 8 20 0 Y 32896 0 63 +def @arg03 8 20 0 Y 32896 0 63 +def @arg04 8 20 0 Y 32896 0 63 +def @arg05 8 20 0 Y 32896 0 63 +def @arg06 8 20 0 Y 32896 0 63 +def @arg07 5 23 0 Y 32896 31 63 +def @arg08 5 23 0 Y 32896 31 63 +def @arg09 5 23 0 Y 32896 31 63 +def @arg10 5 23 0 Y 32896 31 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 +def @arg17 8 20 0 Y 32928 0 63 +def @arg18 8 20 0 Y 32896 0 63 +def @arg19 8 20 0 Y 32896 0 63 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +select @result; +@result +1 test_sequence -- insert into numeric columns -- insert into t9 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 57532797dd7..5c0f01788a6 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -2249,7 +2249,46 @@ def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +execute stmt1 using @result; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 8 20 1 Y 32896 0 63 +def @arg02 8 20 0 Y 32896 0 63 +def @arg03 8 20 0 Y 32896 0 63 +def @arg04 8 20 0 Y 32896 0 63 +def @arg05 8 20 0 Y 32896 0 63 +def @arg06 8 20 0 Y 32896 0 63 +def @arg07 5 23 0 Y 32896 31 63 +def @arg08 5 23 0 Y 32896 31 63 +def @arg09 5 23 0 Y 32896 31 63 +def @arg10 5 23 0 Y 32896 31 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 +def @arg17 8 20 0 Y 32928 0 63 +def @arg18 8 20 0 Y 32896 0 63 +def @arg19 8 20 0 Y 32896 0 63 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 0 31 8 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 0 31 8 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 0 31 8 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 0 31 8 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +select @result; +@result +1 test_sequence -- insert into numeric columns -- insert into t9 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 9a9f457a212..861dba2bd04 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -2185,7 +2185,46 @@ def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +execute stmt1 using @result; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 8 20 1 Y 32896 0 63 +def @arg02 8 20 0 Y 32896 0 63 +def @arg03 8 20 0 Y 32896 0 63 +def @arg04 8 20 0 Y 32896 0 63 +def @arg05 8 20 0 Y 32896 0 63 +def @arg06 8 20 0 Y 32896 0 63 +def @arg07 5 23 0 Y 32896 31 63 +def @arg08 5 23 0 Y 32896 31 63 +def @arg09 5 23 0 Y 32896 31 63 +def @arg10 5 23 0 Y 32896 31 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 +def @arg17 8 20 0 Y 32928 0 63 +def @arg18 8 20 0 Y 32896 0 63 +def @arg19 8 20 0 Y 32896 0 63 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +select @result; +@result +1 test_sequence -- insert into numeric columns -- insert into t9 @@ -5539,7 +5578,46 @@ def @arg32 250 16777215 0 Y 0 31 8 @arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL prepare stmt1 from "select c1 into ? from t9 where c1= 1" ; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? from t9 where c1= 1' at line 1 +execute stmt1 using @result; +execute full_info ; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def @arg01 8 20 1 Y 32896 0 63 +def @arg02 8 20 0 Y 32896 0 63 +def @arg03 8 20 0 Y 32896 0 63 +def @arg04 8 20 0 Y 32896 0 63 +def @arg05 8 20 0 Y 32896 0 63 +def @arg06 8 20 0 Y 32896 0 63 +def @arg07 5 23 0 Y 32896 31 63 +def @arg08 5 23 0 Y 32896 31 63 +def @arg09 5 23 0 Y 32896 31 63 +def @arg10 5 23 0 Y 32896 31 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 +def @arg13 250 16777215 0 Y 0 31 8 +def @arg14 250 16777215 0 Y 0 31 8 +def @arg15 250 16777215 19 Y 0 31 8 +def @arg16 250 16777215 0 Y 0 31 8 +def @arg17 8 20 0 Y 32928 0 63 +def @arg18 8 20 0 Y 32896 0 63 +def @arg19 8 20 0 Y 32896 0 63 +def @arg20 250 16777215 0 Y 0 31 8 +def @arg21 250 16777215 0 Y 0 31 8 +def @arg22 250 16777215 0 Y 0 31 8 +def @arg23 250 16777215 0 Y 128 31 63 +def @arg24 250 16777215 0 Y 0 31 8 +def @arg25 250 16777215 0 Y 128 31 63 +def @arg26 250 16777215 0 Y 0 31 8 +def @arg27 250 16777215 0 Y 128 31 63 +def @arg28 250 16777215 0 Y 0 31 8 +def @arg29 250 16777215 0 Y 128 31 63 +def @arg30 250 16777215 0 Y 0 31 8 +def @arg31 250 16777215 0 Y 0 31 8 +def @arg32 250 16777215 0 Y 0 31 8 +@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32 +0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +select @result; +@result +1 test_sequence -- insert into numeric columns -- insert into t9 diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index f2ad42ebc8d..fe528e1b2e9 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2196,3 +2196,48 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index drop table t1,t2,t3; +# +# MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(a), key(b)); +insert into t2 +select +A.a + B.a* 10 + C.a * 100, +A.a + B.a* 10 + C.a * 100, +12345 +from +t1 A, t1 B, t1 C; +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or a<44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where a < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# Here, conditions b will not be removed, because "c<44" is not sargable +# and hence (b.. and .. b) part is not analyzed at all: +explain extended select * from t2 where c < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15))) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or c < 44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44)) +# Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: +explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +drop table t1,t2; diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 16b35448c50..62bea71173c 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2198,4 +2198,49 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 const PRIMARY PRIMARY 4 const 1 1 SIMPLE t2 range a a 5 NULL 1 Using where; Using index drop table t1,t2,t3; +# +# MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c int, key(a), key(b)); +insert into t2 +select +A.a + B.a* 10 + C.a * 100, +A.a + B.a* 10 + C.a * 100, +12345 +from +t1 A, t1 B, t1 C; +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or a<44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where a < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 range a,b a 5 NULL 43 100.00 Using index condition; Rowid-ordered scan +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where (`test`.`t2`.`a` < 44) +# Here, conditions b will not be removed, because "c<44" is not sargable +# and hence (b.. and .. b) part is not analyzed at all: +explain extended select * from t2 where c < 44 or (b > 25 and b < 15); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44) or ((`test`.`t2`.`b` > 25) and (`test`.`t2`.`b` < 15))) +# EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE: +explain extended select * from t2 where (b > 25 and b < 15) or c < 44; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL b NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` < 44)) +# Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE: +explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where 0 +drop table t1,t2; set optimizer_switch=@mrr_icp_extra_tmp; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 6d6fd2e43d6..371b2de1d80 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -100,20 +100,20 @@ drop table t1; -- after Bug#29394 is implemented. show variables like "wait_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 N 1 0 8 Variable_name Value wait_timeout 28800 show variables like "WAIT_timeout%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 5 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 5 N 1 0 8 Variable_name Value wait_timeout 28800 show variables like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def information_schema VARIABLES VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 -def information_schema VARIABLES VARIABLES VARIABLE_VALUE Value 253 1024 0 Y 0 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 1024 0 N 1 0 8 Variable_name Value show table status from test like "this_doesn't_exists%"; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result index 3695384bac4..8aefb552d57 100644 --- a/mysql-test/r/show_explain.result +++ b/mysql-test/r/show_explain.result @@ -1036,7 +1036,7 @@ explain SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 -1 SIMPLE t1 index b b 6 NULL 107 Using where; Using index +1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index 1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index set @show_explain_probe_select_id=1; set debug_dbug='+d,show_explain_probe_do_select'; @@ -1044,7 +1044,7 @@ SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, fie show explain for $thr2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 system NULL NULL NULL NULL 1 Using filesort -1 SIMPLE t1 index b b 6 NULL 107 Using where; Using index +1 SIMPLE t1 range b b 6 NULL 107 Using where; Using index 1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index Warnings: Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2 diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 5678a455234..55184f42c97 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -6974,7 +6974,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -7008,7 +7008,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index a909230121d..87645d187f2 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -427,6 +427,8 @@ KEY `varchar_key` (`varchar_key`) INSERT INTO `t1` VALUES (10,'00:00:00','i','i'),(11,'00:00:00','',''); set @old_optimizer_switch = @@session.optimizer_switch; SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off,mrr=on,engine_condition_pushdown=on'; +Warnings: +Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release. SELECT `time_nokey` G1 FROM t1 WHERE ( `varchar_nokey` , `varchar_key` ) IN ( SELECT `varchar_nokey` , `varchar_nokey` ) AND `varchar_key` >= 'c' HAVING G1 ORDER BY `pk` ; @@ -615,6 +617,8 @@ INSERT INTO t2 VALUES (9,1); # Enable Index condition pushdown set @old_icp=@@optimizer_switch; SET SESSION optimizer_switch="engine_condition_pushdown=on"; +Warnings: +Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release. SELECT pk FROM t2 diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index 6cc627ad16c..30b020cbcf6 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -103,7 +103,7 @@ explain extended select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL # 18 # 3 100.00 # -2 MATERIALIZED t2i index it2i1,it2i3 # 9 # 5 100.00 # +2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 # Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <`test`.`t1i`.`a1`>((`test`.`t1i`.`a1`,`test`.`t1i`.`a1` in ( (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1` ), (`test`.`t1i`.`a1` in on distinct_key where ((`test`.`t1i`.`a1` = ``.`max(b1)`)))))) select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result index 5434bb920e3..58ee06d754d 100644 --- a/mysql-test/r/subselect_no_exists_to_in.result +++ b/mysql-test/r/subselect_no_exists_to_in.result @@ -6974,7 +6974,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -7008,7 +7008,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index 3325889e1e0..53307efdb89 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -6968,7 +6968,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -7001,7 +7001,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index 01af3ea4b16..c228ae46347 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -6965,7 +6965,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -6999,7 +6999,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index 16ebf7a4199..7d1dde6498e 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -6980,7 +6980,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -7014,7 +7014,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index d98f7ad67de..c850644fbaa 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -6965,7 +6965,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # @@ -6999,7 +6999,7 @@ INSERT INTO t2 VALUES (45),(17),(20); EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index +2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; # diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result index 95dfc34777b..7417ab56ff8 100644 --- a/mysql-test/r/subselect_sj_mat.result +++ b/mysql-test/r/subselect_sj_mat.result @@ -107,7 +107,7 @@ select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index it1i1,it1i3 # 18 # 3 100.00 # 1 PRIMARY eq_ref distinct_key # 8 # 1 100.00 # -2 MATERIALIZED t2i index it2i1,it2i3 # 9 # 5 100.00 # +2 MATERIALIZED t2i range it2i1,it2i3 # 9 # 5 100.00 # Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from (select max(`test`.`t2i`.`b1`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where (``.`max(b1)` = `test`.`t1i`.`a1`) select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1); diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 0204354d9e3..f195b0a607e 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -131,6 +131,7 @@ user CREATE TABLE `user` ( `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index 0204354d9e3..f195b0a607e 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -131,6 +131,7 @@ user CREATE TABLE `user` ( `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; diff --git a/mysql-test/r/system_mysql_db_fix50030.result b/mysql-test/r/system_mysql_db_fix50030.result index 0204354d9e3..f195b0a607e 100644 --- a/mysql-test/r/system_mysql_db_fix50030.result +++ b/mysql-test/r/system_mysql_db_fix50030.result @@ -131,6 +131,7 @@ user CREATE TABLE `user` ( `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; diff --git a/mysql-test/r/system_mysql_db_fix50117.result b/mysql-test/r/system_mysql_db_fix50117.result index 0204354d9e3..f195b0a607e 100644 --- a/mysql-test/r/system_mysql_db_fix50117.result +++ b/mysql-test/r/system_mysql_db_fix50117.result @@ -131,6 +131,7 @@ user CREATE TABLE `user` ( `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' show create table func; diff --git a/mysql-test/r/temp_table_frm.result b/mysql-test/r/temp_table_frm.result index ff809957a3d..4f60ccc32c8 100644 --- a/mysql-test/r/temp_table_frm.result +++ b/mysql-test/r/temp_table_frm.result @@ -1,3 +1,4 @@ +set @@session.max_heap_table_size=16*1024*1024; create table t1 select * from information_schema.session_status where variable_name like 'Opened%'; create temporary table t2 (a int) engine=memory; select variable_name, session_status.variable_value - t1.variable_value diff --git a/mysql-test/r/status_user.result b/mysql-test/r/userstat.result similarity index 84% rename from mysql-test/r/status_user.result rename to mysql-test/r/userstat.result index 829c8abb634..5ce10d96643 100644 --- a/mysql-test/r/status_user.result +++ b/mysql-test/r/userstat.result @@ -25,6 +25,8 @@ DENIED_CONNECTIONS bigint(21) NO 0 LOST_CONNECTIONS bigint(21) NO 0 ACCESS_DENIED bigint(21) NO 0 EMPTY_QUERIES bigint(21) NO 0 +TOTAL_SSL_CONNECTIONS bigint(21) unsigned NO 0 +MAX_STATEMENT_TIME_EXCEEDED bigint(21) NO 0 show columns from information_schema.user_statistics; Field Type Null Key Default Extra USER varchar(128) NO @@ -50,6 +52,8 @@ DENIED_CONNECTIONS bigint(21) NO 0 LOST_CONNECTIONS bigint(21) NO 0 ACCESS_DENIED bigint(21) NO 0 EMPTY_QUERIES bigint(21) NO 0 +TOTAL_SSL_CONNECTIONS bigint(21) unsigned NO 0 +MAX_STATEMENT_TIME_EXCEEDED bigint(21) NO 0 show columns from information_schema.index_statistics; Field Type Null Key Default Extra TABLE_SCHEMA varchar(192) NO @@ -76,6 +80,9 @@ delete from t1 where a=3; select * from t1 where a=999; a b drop table t1; +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA create table t1 (a int, primary key (a), b int default 0) engine=innodb; begin; insert into t1 values(1,1); @@ -138,8 +145,9 @@ test t1 6 13 13 show index_statistics; Table_schema Table_name Index_name Rows_read test t1 PRIMARY 2 -select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;; -TOTAL_CONNECTIONS 1 +select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;; +TOTAL_CONNECTIONS 2 +TOTAL_SSL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 ROWS_READ 6 ROWS_SENT 2 @@ -155,8 +163,9 @@ DENIED_CONNECTIONS 0 LOST_CONNECTIONS 0 ACCESS_DENIED 0 EMPTY_QUERIES 1 -select TOTAL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;; -TOTAL_CONNECTIONS 1 +select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;; +TOTAL_CONNECTIONS 2 +TOTAL_SSL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 ROWS_READ 6 ROWS_SENT 2 @@ -178,12 +187,9 @@ select * from information_schema.index_statistics; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ select * from information_schema.table_statistics; TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES -show status like "%statistics%"; +show status like "%generic%"; Variable_name Value -Com_show_client_statistics 0 -Com_show_index_statistics 1 -Com_show_table_statistics 1 -Com_show_user_statistics 0 +Com_show_generic 2 select connected_time <> 0, busy_time <> 0, bytes_received <> 0, bytes_sent <> 0, binlog_bytes_written <> 0 from information_schema.user_statistics; diff --git a/mysql-test/std_data/funcs_1/ndb_tb1.txt b/mysql-test/std_data/funcs_1/ndb_tb1.txt deleted file mode 100644 index 4c20ed1661b..00000000000 --- a/mysql-test/std_data/funcs_1/ndb_tb1.txt +++ /dev/null @@ -1,10 +0,0 @@ - a`0 a`0 0` 0` a`0 a`0 0` 0` ! 6 163 103 238 3058 30243 22056 9444 -5 1 1 1 -5 1 1 1 -5 1 1 1 -5 1 1 1 -5 -5 1 1 1 1 1 1 -5 0.0 1 0.0 1 0.0 1 0.0 -5 1 1 1 -5 -5 - aa0 aa0 1aa 1aa aa0 aa0 1aa 1aa @ 9 207 1 246 13214 57220 1505 58996 -4 2 2 2 -4 2 2 2 -4 2 2 2 -4 2 2 2 -4 -4 2 2 2 2 2 2 -4 1.1 2 1.1 2 1.1 2 1.1 -4 2 2 2 -4 -4 - ab0 ab0 2baa 2baa ab0 ab0 2baa 2baa # 3 50 103 193 10965 3038 31585 20149 -3 3 3 3 -3 3 3 3 -3 3 3 3 -3 3 3 3 -3 -3 3 3 3 3 3 3 -3 2.2 3 2.2 3 2.2 3 2.2 -3 3 3 3 -3 -3 - ac0 ac0 3caaa 3caaa ac0 ac0 3caaa 3caaa $ 62 188 47 176 5103 58378 13178 38317 -2 4 4 4 -2 4 4 4 -2 4 4 4 -2 4 4 4 -2 -2 4 4 4 4 4 4 -2 3.3 4 3.3 4 3.3 4 3.3 -2 4 4 4 -2 -2 - ad0 ad0 4daaaa 4daaaa ad0 ad0 4daaaa 4daaaa % 59 15 21 80 17942 48443 12646 53903 -1 5 5 5 -1 5 5 5 -1 5 5 5 -1 5 5 5 -1 -1 5 5 5 5 5 5 -1 4.4 5 4.4 5 4.4 5 4.4 -1 5 5 5 -1 -1 - ae0 ae0 5eaaaaa 5eaaaaa ae0 ae0 5eaaaaa 5eaaaaa ^ 86 223 103 88 3880 31147 5801 28348 0 6 6 6 0 6 6 6 0 6 6 6 0 6 6 6 0 0 6 6 6 6 6 6 0 5.5 6 5.5 6 5.5 6 5.5 0 6 6 6 0 0 - af0 af0 6faaaaaa 6faaaaaa af0 af0 6faaaaaa 6faaaaaa & 124 125 77 208 2591 29533 18803 21557 1 7 7 7 1 7 7 7 1 7 7 7 1 7 7 7 1 1 7 7 7 7 7 7 1 6.6 7 6.6 7 6.6 7 6.6 1 7 7 7 1 1 - ag0 ag0 7gaaaaaaa 7gaaaaaaa ag0 ag0 7gaaaaaaa 7gaaaaaaa * 123 103 80 92 10179 60769 25778 58195 2 8 8 8 2 8 8 8 2 8 8 8 2 8 8 8 2 2 8 8 8 8 8 8 2 7.7 8 7.7 8 7.7 8 7.7 2 8 8 8 2 2 - a^0 a^0 8^aaaaaaaa 8^aaaaaaaa a^0 a^0 8^aaaaaaaa 8^aaaaaaaa ( 111 166 81 66 5159 2177 6774 38396 3 9 9 9 3 9 9 9 3 9 9 9 3 9 9 9 3 3 9 9 9 9 9 9 3 8.8 9 8.8 9 8.8 9 8.8 3 9 9 9 3 3 - a_0 a_0 9_aaaaaaaaa 9_aaaaaaaaa a_0 a_0 9_aaaaaaaaa 9_aaaaaaaaa ) 37 174 97 34 9183 16470 13064 6297 4 10 10 10 4 10 10 10 4 10 10 10 4 10 10 10 4 4 10 10 10 10 10 10 4 9.9 10 9.9 10 9.9 10 9.9 4 10 10 10 4 4 diff --git a/mysql-test/std_data/funcs_1/ndb_tb2.txt b/mysql-test/std_data/funcs_1/ndb_tb2.txt deleted file mode 100644 index 8ae7dea6df4..00000000000 --- a/mysql-test/std_data/funcs_1/ndb_tb2.txt +++ /dev/null @@ -1,10 +0,0 @@ -1 1 1 1 1 1 -5 0.0 1 0.0 1 0.0 1 0.0 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 -1.17549435e-38 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 -1.17549435e-38 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1000-01-01 838:59:58 1970-01-02 00:00:01 19700102000001 1902 1902 1902 2 2 -2 2 2 2 2 2 -4 1.1 2 1.1 2 1.1 2 1.1 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 -1.175494349e-38 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 -1.175494349e-38 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1000-01-02 838:59:57 1970-01-03 00:00:02 19700103000002 1903 1903 1903 1 3 -3 3 3 3 3 3 -3 2.2 3 2.2 3 2.2 3 2.2 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 -1.175494348e-38 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 -1.175494348e-38 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1000-01-03 838:59:56 1970-01-04 00:00:03 19700104000003 1904 1904 1904 2 1 -4 4 4 4 4 4 -2 3.3 4 3.3 4 3.3 4 3.3 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 -1.175494347e-38 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 -1.175494347e-38 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1000-01-04 838:59:55 1970-01-05 00:00:04 19700105000004 1905 1905 1905 1 2 -5 5 5 5 5 5 -1 4.4 5 4.4 5 4.4 5 4.4 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 -1.175494346e-38 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 -1.175494346e-38 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1000-01-05 838:59:54 1970-01-06 00:00:05 19700106000005 1906 1906 1906 2 3 -6 6 6 6 6 6 0 5.5 6 5.5 6 5.5 6 5.5 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 -1.175494345e-38 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 -1.175494345e-38 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1000-01-06 838:59:53 1970-01-07 00:00:06 19700107000006 1907 1907 1907 1 1 -7 7 7 7 7 7 1 6.6 7 6.6 7 6.6 7 6.6 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 -1.175494344e-38 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 -1.175494344e-38 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1000-01-07 838:59:52 1970-01-08 00:00:07 19700108000007 1908 1908 1908 2 2 -8 8 8 8 8 8 2 7.7 8 7.7 8 7.7 8 7.7 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 -1.175494343e-38 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 -1.175494343e-38 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1000-01-08 838:59:51 1970-01-09 00:00:08 19700109000008 1909 1909 1909 1 3 -9 9 9 9 9 9 3 8.8 9 8.8 9 8.8 9 8.8 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 -1.175494342e-38 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 -1.175494342e-38 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1000-01-09 838:59:50 1970-01-10 00:00:09 19700110000009 1910 1910 1910 2 1 -10 10 10 10 10 10 4 9.9 10 9.9 10 9.9 10 9.9 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 -1.175494341e-38 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 -1.175494341e-38 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1000-01-10 838:59:49 1970-01-11 00:00:10 19700111000010 1911 1911 1911 1 2 diff --git a/mysql-test/std_data/funcs_1/ndb_tb3.txt b/mysql-test/std_data/funcs_1/ndb_tb3.txt deleted file mode 100644 index a01cc36da54..00000000000 --- a/mysql-test/std_data/funcs_1/ndb_tb3.txt +++ /dev/null @@ -1,10 +0,0 @@ -! ! ! a`0 a`0 0` 0` a`0 a`0 0` 0` ! 37 102 115 214 22348 22112 23636 18043 -5 1 1 1 -5 1 1 1 -5 1 1 1 -5 1 1 1 -5 -5 1 1 1 1 1 1 -5 0.0 1 0.0 1 0.0 1 0.0 -5 1 1 1 -5 -5 -@ @ @ aa0 aa0 1aa 1aa aa0 aa0 1aa 1aa @ 30 114 62 146 22059 6000 19024 8674 -4 2 2 2 -4 2 2 2 -4 2 2 2 -4 2 2 2 -4 -4 2 2 2 2 2 2 -4 1.1 2 1.1 2 1.1 2 1.1 -4 2 2 2 -4 -4 -# # # ab0 ab0 2baa 2baa ab0 ab0 2baa 2baa # 113 254 52 51 27963 63797 516 63989 -3 3 3 3 -3 3 3 3 -3 3 3 3 -3 3 3 3 -3 -3 3 3 3 3 3 3 -3 2.2 3 2.2 3 2.2 3 2.2 -3 3 3 3 -3 -3 -$ $ $ ac0 ac0 3caaa 3caaa ac0 ac0 3caaa 3caaa $ 70 78 40 203 28716 18828 14939 30960 -2 4 4 4 -2 4 4 4 -2 4 4 4 -2 4 4 4 -2 -2 4 4 4 4 4 4 -2 3.3 4 3.3 4 3.3 4 3.3 -2 4 4 4 -2 -2 -% % % ad0 ad0 4daaaa 4daaaa ad0 ad0 4daaaa 4daaaa % 1 228 76 249 16746 12853 8405 35402 -1 5 5 5 -1 5 5 5 -1 5 5 5 -1 5 5 5 -1 -1 5 5 5 5 5 5 -1 4.4 5 4.4 5 4.4 5 4.4 -1 5 5 5 -1 -1 -^ ^ ^ ae0 ae0 5eaaaaa 5eaaaaa ae0 ae0 5eaaaaa 5eaaaaa ^ 116 52 51 248 26877 15243 20063 65464 0 6 6 6 0 6 6 6 0 6 6 6 0 6 6 6 0 0 6 6 6 6 6 6 0 5.5 6 5.5 6 5.5 6 5.5 0 6 6 6 0 0 -& & & af0 af0 6faaaaaa 6faaaaaa af0 af0 6faaaaaa 6faaaaaa & 59 163 63 26 24559 55618 27326 12704 1 7 7 7 1 7 7 7 1 7 7 7 1 7 7 7 1 1 7 7 7 7 7 7 1 6.6 7 6.6 7 6.6 7 6.6 1 7 7 7 1 1 -* * * ag0 ag0 7gaaaaaaa 7gaaaaaaa ag0 ag0 7gaaaaaaa 7gaaaaaaa * 69 229 119 159 11779 48557 14747 42703 2 8 8 8 2 8 8 8 2 8 8 8 2 8 8 8 2 2 8 8 8 8 8 8 2 7.7 8 7.7 8 7.7 8 7.7 2 8 8 8 2 2 -( ( ( a^0 a^0 8^aaaaaaaa 8^aaaaaaaa a^0 a^0 8^aaaaaaaa 8^aaaaaaaa ( 54 89 113 155 1068 61537 14823 43439 3 9 9 9 3 9 9 9 3 9 9 9 3 9 9 9 3 3 9 9 9 9 9 9 3 8.8 9 8.8 9 8.8 9 8.8 3 9 9 9 3 3 -) ) ) a_0 a_0 9_aaaaaaaaa 9_aaaaaaaaa a_0 a_0 9_aaaaaaaaa 9_aaaaaaaaa ) 68 34 44 175 32453 44381 506 37695 4 10 10 10 4 10 10 10 4 10 10 10 4 10 10 10 4 4 10 10 10 10 10 10 4 9.9 10 9.9 10 9.9 10 9.9 4 10 10 10 4 4 diff --git a/mysql-test/std_data/funcs_1/ndb_tb4.txt b/mysql-test/std_data/funcs_1/ndb_tb4.txt deleted file mode 100644 index 5092371d093..00000000000 --- a/mysql-test/std_data/funcs_1/ndb_tb4.txt +++ /dev/null @@ -1,10 +0,0 @@ -1 1 1 1 1 1 -5 0.0 1 0.0 1 0.0 1 0.0 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 -1.17549435e-38 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 -1.17549435e-38 -1.17549435e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1.175494352e-38 1000-01-01 838:59:58 1970-01-02 00:00:01 19700102000001 1902 1902 1902 2 2 0! 0 0 0 0! -2 2 2 2 2 2 -4 1.1 2 1.1 2 1.1 2 1.1 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 -1.175494349e-38 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 -1.175494349e-38 -1.175494349e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1.175494353e-38 1000-01-02 838:59:57 1970-01-03 00:00:02 19700103000002 1903 1903 1903 1 3 1@# 1@ 1@ 1@ 1@# -3 3 3 3 3 3 -3 2.2 3 2.2 3 2.2 3 2.2 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 -1.175494348e-38 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 -1.175494348e-38 -1.175494348e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1.175494354e-38 1000-01-03 838:59:56 1970-01-04 00:00:03 19700104000003 1904 1904 1904 2 1 2#$% 2#$ 2#$ 2#$ 2#$% -4 4 4 4 4 4 -2 3.3 4 3.3 4 3.3 4 3.3 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 -1.175494347e-38 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 -1.175494347e-38 -1.175494347e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1.175494355e-38 1000-01-04 838:59:55 1970-01-05 00:00:04 19700105000004 1905 1905 1905 1 2 3$%^& 3$%^ 3$%^ 3$%^ 3$%^& -5 5 5 5 5 5 -1 4.4 5 4.4 5 4.4 5 4.4 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 -1.175494346e-38 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 -1.175494346e-38 -1.175494346e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1.175494356e-38 1000-01-05 838:59:54 1970-01-06 00:00:05 19700106000005 1906 1906 1906 2 3 4%^&*( 4%^&* 4%^&* 4%^&* 4%^&*( -6 6 6 6 6 6 0 5.5 6 5.5 6 5.5 6 5.5 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 -1.175494345e-38 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 -1.175494345e-38 -1.175494345e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1.175494357e-38 1000-01-06 838:59:53 1970-01-07 00:00:06 19700107000006 1907 1907 1907 1 1 5^&*()_ 5^&*() 5^&*() 5^&*() 5^&*()_ -7 7 7 7 7 7 1 6.6 7 6.6 7 6.6 7 6.6 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 -1.175494344e-38 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 -1.175494344e-38 -1.175494344e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1.175494358e-38 1000-01-07 838:59:52 1970-01-08 00:00:07 19700108000007 1908 1908 1908 2 2 6&*()_+= 6&*()_+ 6&*()_+ 6&*()_+ 6&*()_+= -8 8 8 8 8 8 2 7.7 8 7.7 8 7.7 8 7.7 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 -1.175494343e-38 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 -1.175494343e-38 -1.175494343e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1.175494359e-38 1000-01-08 838:59:51 1970-01-09 00:00:08 19700109000008 1909 1909 1909 1 3 7*()_+=-| 7*()_+=- 7*()_+=- 7*()_+=- 7*()_+=-| -9 9 9 9 9 9 3 8.8 9 8.8 9 8.8 9 8.8 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 -1.175494342e-38 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 -1.175494342e-38 -1.175494342e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1.17549436e-38 1000-01-09 838:59:50 1970-01-10 00:00:09 19700110000009 1910 1910 1910 2 1 8()_+=-|{} 8()_+=-|{ 8()_+=-|{ 8()_+=-|{ 8()_+=-|{} -10 10 10 10 10 10 4 9.9 10 9.9 10 9.9 10 9.9 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 -1.175494341e-38 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 -1.175494341e-38 -1.175494341e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1.175494361e-38 1000-01-10 838:59:49 1970-01-11 00:00:10 19700111000010 1911 1911 1911 1 2 9)_+=-|{}[] 9)_+=-|{}[ 9)_+=-|{}[ 9)_+=-|{}[ 9)_+=-|{}[] diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data deleted file mode 100644 index 32494d5a1e7..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-1-0.1.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data b/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data deleted file mode 100644 index 2141fb0a6e4..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-1-0.2.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl deleted file mode 100644 index cbe548e0ca5..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-1.1.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log b/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log deleted file mode 100644 index e4e114d4b46..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-1.1.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl deleted file mode 100644 index cbe548e0ca5..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-1.2.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log b/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log deleted file mode 100644 index a1c89b7015c..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-1.2.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-2-0.1.Data b/mysql-test/std_data/ndb_backup50/BACKUP-2-0.1.Data deleted file mode 100644 index 09e63064666..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-2-0.1.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-2-0.2.Data b/mysql-test/std_data/ndb_backup50/BACKUP-2-0.2.Data deleted file mode 100644 index a8332239d8f..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-2-0.2.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-2.1.ctl b/mysql-test/std_data/ndb_backup50/BACKUP-2.1.ctl deleted file mode 100644 index f54103a2a44..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-2.1.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-2.1.log b/mysql-test/std_data/ndb_backup50/BACKUP-2.1.log deleted file mode 100644 index 5564f952e66..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-2.1.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-2.2.ctl b/mysql-test/std_data/ndb_backup50/BACKUP-2.2.ctl deleted file mode 100644 index f54103a2a44..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-2.2.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup50/BACKUP-2.2.log b/mysql-test/std_data/ndb_backup50/BACKUP-2.2.log deleted file mode 100644 index 5564f952e66..00000000000 Binary files a/mysql-test/std_data/ndb_backup50/BACKUP-2.2.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data deleted file mode 100644 index 2407d1f261b..00000000000 Binary files a/mysql-test/std_data/ndb_backup51/BACKUP-1-0.1.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data b/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data deleted file mode 100644 index f21e9886523..00000000000 Binary files a/mysql-test/std_data/ndb_backup51/BACKUP-1-0.2.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl deleted file mode 100644 index 99e2f297693..00000000000 Binary files a/mysql-test/std_data/ndb_backup51/BACKUP-1.1.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log b/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log deleted file mode 100644 index 4448cd98c04..00000000000 Binary files a/mysql-test/std_data/ndb_backup51/BACKUP-1.1.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl deleted file mode 100644 index 99e2f297693..00000000000 Binary files a/mysql-test/std_data/ndb_backup51/BACKUP-1.2.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log b/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log deleted file mode 100644 index 3be69891402..00000000000 Binary files a/mysql-test/std_data/ndb_backup51/BACKUP-1.2.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.1.Data b/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.1.Data deleted file mode 100644 index 267039d757e..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.1.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.2.Data b/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.2.Data deleted file mode 100644 index 9033c2735e1..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.2.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.1.ctl b/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.1.ctl deleted file mode 100644 index 30fd0a2dda1..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.1.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.1.log b/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.1.log deleted file mode 100644 index 39f7244b014..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.1.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.2.ctl b/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.2.ctl deleted file mode 100644 index 30fd0a2dda1..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.2.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.2.log b/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.2.log deleted file mode 100644 index 39f7244b014..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1.2.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.1.Data b/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.1.Data deleted file mode 100644 index 45d4d536c02..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.1.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.2.Data b/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.2.Data deleted file mode 100644 index 067fc6b716d..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.2.Data and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.1.ctl b/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.1.ctl deleted file mode 100644 index 949b7d0be8b..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.1.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.1.log b/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.1.log deleted file mode 100644 index 3686d2718a2..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.1.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.2.ctl b/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.2.ctl deleted file mode 100644 index 949b7d0be8b..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.2.ctl and /dev/null differ diff --git a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.2.log b/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.2.log deleted file mode 100644 index 3686d2718a2..00000000000 Binary files a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1.2.log and /dev/null differ diff --git a/mysql-test/std_data/ndb_config_config.ini b/mysql-test/std_data/ndb_config_config.ini deleted file mode 100644 index c325952d322..00000000000 --- a/mysql-test/std_data/ndb_config_config.ini +++ /dev/null @@ -1,55 +0,0 @@ -[ndbd default] -NoOfReplicas= 2 -MaxNoOfConcurrentTransactions= 64 -MaxNoOfConcurrentOperations= 10000 -DataMemory= 20M -IndexMemory= 1M -Diskless= 0 -TimeBetweenWatchDogCheck= 30000 -DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095 -MaxNoOfOrderedIndexes= 32 -MaxNoOfAttributes= 2048 -TimeBetweenGlobalCheckpoints= 500 -NoOfFragmentLogFiles= 4 -FragmentLogFileSize=12M -DiskPageBufferMemory= 4M -# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612 -#ODirect= 1 -# the following parametes just function as a small regression -# test that the parameter exists -InitialNoOfOpenFiles= 27 - -# -# Increase timeouts to cater for slow test-machines -# (possibly running several tests in parallell) -# -HeartbeatIntervalDbDb= 30000 -HeartbeatIntervalDbApi= 30000 -#TransactionDeadlockDetectionTimeout= 7500 - -[ndbd] -HostName= localhost - -[ndbd] -HostName= localhost - -[ndb_mgmd] -HostName= localhost -DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095 # -PortNumber= 10095 - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] - -[mysqld] diff --git a/mysql-test/std_data/ndb_config_mycnf1.cnf b/mysql-test/std_data/ndb_config_mycnf1.cnf deleted file mode 100644 index c680bfd8fa3..00000000000 --- a/mysql-test/std_data/ndb_config_mycnf1.cnf +++ /dev/null @@ -1,15 +0,0 @@ -[cluster_config] -NoOfReplicas=1 -DataMemory=50M - -[cluster_config.jonas] -IndexMemory=50M -ndbd = localhost,localhost,localhost,localhost -ndb_mgmd = localhost -mysqld = localhost - -[cluster_config.ndbd.1] -DataMemory=25M - -[cluster_config.ndbd.2.jonas] -DataMemory=35M diff --git a/mysql-test/std_data/ndb_config_mycnf2.cnf b/mysql-test/std_data/ndb_config_mycnf2.cnf deleted file mode 100644 index 3bf6b9a1194..00000000000 --- a/mysql-test/std_data/ndb_config_mycnf2.cnf +++ /dev/null @@ -1,31 +0,0 @@ -# -# Testing automatic node id generation -# -[cluster_config] -NoOfReplicas=2 -Signum=39 - -[cluster_config.cluster0] -ndbd = localhost,localhost,localhost,localhost -ndb_mgmd = localhost -mysqld = ,,,, - -[cluster_config.cluster1] -ndbd = localhost,localhost,localhost,localhost -ndb_mgmd = localhost -mysqld = ,,,, -[cluster_config.ndbd.1.cluster1] -NodeId=2 -[cluster_config.mysqld.1.cluster1] -NodeId=1 - -[cluster_config.cluster2] -ndbd = localhost,localhost,localhost,localhost -ndb_mgmd = localhost,localhost -mysqld = ,,,, -[cluster_config.mysqld.1.cluster2] -NodeId=11 -[cluster_config.ndb_mgmd.1.cluster2] -NodeId=1 -[cluster_config.ndbd.1.cluster2] -NodeId=3 diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index d80b4aaf822..7f7f1f599a1 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -23,6 +23,16 @@ sub skip_combinations { # don't run tests for the wrong platform $skip{'include/platform.combinations'} = [ (IS_WINDOWS) ? 'unix' : 'win' ]; + # and for the wrong word size + # check for exact values, in case the default changes to be small everywhere + my $longsysvar= $::mysqld_variables{'max-binlog-stmt-cache-size'}; + my %val_map= ( + '4294963200' => '64bit', # remember, it shows *what configuration to skip* + '18446744073709547520' => '32bit' + ); + die "unknown value max-binlog-stmt-cache-size=$longsysvar" unless $val_map{$longsysvar}; + $skip{'include/word_size.combinations'} = [ $val_map{$longsysvar} ]; + # as a special case, disable certain include files as a whole $skip{'include/not_embedded.inc'} = 'Not run for embedded server' if $::opt_embedded_server; diff --git a/mysql-test/suite/binlog/r/binlog_multi_engine.result b/mysql-test/suite/binlog/r/binlog_multi_engine.result deleted file mode 100644 index d0febc3f8bc..00000000000 --- a/mysql-test/suite/binlog/r/binlog_multi_engine.result +++ /dev/null @@ -1,106 +0,0 @@ -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM; -CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE; -CREATE TABLE t1n (e INT, f INT) ENGINE=NDB; -RESET MASTER; -SET SESSION BINLOG_FORMAT=STATEMENT; -INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); -UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; -The last event before the COMMIT is use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c -*** Please look in binlog_multi_engine.test if you have a diff here **** -START TRANSACTION; -INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); -UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; -Warnings: -Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. -UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; -COMMIT; -TRUNCATE t1m; -TRUNCATE t1b; -TRUNCATE t1n; -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2) -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2) -mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Table_map # # table_id: # (test.t1n) -mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) -mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m -mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b -mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n -RESET MASTER; -SET SESSION BINLOG_FORMAT=MIXED; -INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); -The last event before the COMMIT is use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) -INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); -UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; -UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; -ERROR HY000: Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging. -TRUNCATE t1m; -TRUNCATE t1b; -TRUNCATE t1n; -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2) -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Table_map # # table_id: # (test.t1n) -mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) -mysqld-bin.000001 # Write_rows # # table_id: # -mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m -mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b -mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n -RESET MASTER; -SET SESSION BINLOG_FORMAT=ROW; -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); -INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); -INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); -UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; -ERROR HY000: Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging. -UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; -ERROR HY000: Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging. -show binlog events from ; -Log_name Pos Event_type Server_id End_log_pos Info -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Table_map # # table_id: # (test.t1m) -mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Table_map # # table_id: # (test.t1b) -mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -mysqld-bin.000001 # Query # # COMMIT -mysqld-bin.000001 # Query # # BEGIN -mysqld-bin.000001 # Table_map # # table_id: # (test.t1n) -mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) -mysqld-bin.000001 # Write_rows # # table_id: # -mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -mysqld-bin.000001 # Query # # COMMIT -RESET MASTER; -DROP TABLE t1m, t1b, t1n; diff --git a/mysql-test/suite/binlog/r/binlog_old_versions.result b/mysql-test/suite/binlog/r/binlog_old_versions.result index 594f1101a38..30b64535eb4 100644 --- a/mysql-test/suite/binlog/r/binlog_old_versions.result +++ b/mysql-test/suite/binlog/r/binlog_old_versions.result @@ -53,7 +53,7 @@ SELECT COUNT(*) FROM t3; COUNT(*) 17920 DROP TABLE t1, t3; -==== Read binlog from ndb tree (mysql-5.1-telco-6.1) ==== +==== Read binlog from telco tree (mysql-5.1-telco-6.1) ==== SELECT * FROM t1 ORDER BY a; a b 0 last_insert_id diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 20a4b52f1a7..05009c5a570 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -806,9 +806,11 @@ SELECT * FROM t1; c1 1 # Their values should be ON -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; Variable_name Value foreign_key_checks ON +SHOW SESSION VARIABLES LIKE "unique_checks"; +Variable_name Value unique_checks ON SET @@SESSION.foreign_key_checks= OFF; @@ -824,9 +826,11 @@ c1 1 2 # Their values should be OFF -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; Variable_name Value foreign_key_checks OFF +SHOW SESSION VARIABLES LIKE "unique_checks"; +Variable_name Value unique_checks OFF # INSERT INTO t1 VALUES(2) # foreign_key_checks=1 and unique_checks=1 @@ -842,8 +846,10 @@ c1 1 2 # Their values should be OFF -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; Variable_name Value foreign_key_checks OFF +SHOW SESSION VARIABLES LIKE "unique_checks"; +Variable_name Value unique_checks OFF DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index 824bf3ed2a0..3a6af15e88a 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -618,9 +618,11 @@ SELECT * FROM t1; c1 1 # Their values should be ON -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; Variable_name Value foreign_key_checks ON +SHOW SESSION VARIABLES LIKE "unique_checks"; +Variable_name Value unique_checks ON SET @@SESSION.foreign_key_checks= OFF; @@ -636,9 +638,11 @@ c1 1 2 # Their values should be OFF -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; Variable_name Value foreign_key_checks OFF +SHOW SESSION VARIABLES LIKE "unique_checks"; +Variable_name Value unique_checks OFF # INSERT INTO t1 VALUES(2) # foreign_key_checks=1 and unique_checks=1 @@ -654,8 +658,10 @@ c1 1 2 # Their values should be OFF -SHOW SESSION VARIABLES LIKE "%_checks"; +SHOW SESSION VARIABLES LIKE "foreign_key_checks"; Variable_name Value foreign_key_checks OFF +SHOW SESSION VARIABLES LIKE "unique_checks"; +Variable_name Value unique_checks OFF DROP TABLE t1; diff --git a/mysql-test/suite/binlog/t/binlog_multi_engine.test b/mysql-test/suite/binlog/t/binlog_multi_engine.test deleted file mode 100644 index 90fddd4f3fd..00000000000 --- a/mysql-test/suite/binlog/t/binlog_multi_engine.test +++ /dev/null @@ -1,110 +0,0 @@ -# Test to test how logging is done depending on the capabilities of -# the engines. Unfortunately, we don't have a good row-only logging -# engine, and NDB does not really cut is since it is also -# self-logging. I'm using it nevertheless. - -source include/have_blackhole.inc; -source include/have_ndb.inc; -source include/have_log_bin.inc; - -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - -CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM; -CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE; -CREATE TABLE t1n (e INT, f INT) ENGINE=NDB; - -RESET MASTER; - -SET SESSION BINLOG_FORMAT=STATEMENT; - -INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); - -UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; - -# Here and below we need to wait when some event appears in binlog -# to avoid unsrted mixing local events and from NDB -let $wait_binlog_event= COMMIT; -source include/wait_for_binlog_event.inc; -let $event= query_get_value(SHOW BINLOG EVENTS, Info, 9); ---echo The last event before the COMMIT is $event - -echo *** Please look in binlog_multi_engine.test if you have a diff here ****; -START TRANSACTION; -INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); -UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; -UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; -COMMIT; - -let $wait_binlog_event= COMMIT; -source include/wait_for_binlog_event.inc; - -TRUNCATE t1m; -TRUNCATE t1b; -TRUNCATE t1n; - -let $wait_binlog_event= t1n; -source include/wait_for_binlog_event.inc; - -source include/show_binlog_events.inc; - -RESET MASTER; - -SET SESSION BINLOG_FORMAT=MIXED; - -INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); - -let $wait_binlog_event= COMMIT; -source include/wait_for_binlog_event.inc; -let $event= query_get_value(SHOW BINLOG EVENTS, Info, 6); ---echo The last event before the COMMIT is $event - -INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); - -let $wait_binlog_event= COMMIT; -source include/wait_for_binlog_event.inc; - -UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; -error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE; -UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; - -# Not possible to test this since NDB writes its own binlog, which -# might cause it to be out of sync with the results from MyISAM. -# This will generate an error once BUG#28722 is fixed. - -#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; - -TRUNCATE t1m; -TRUNCATE t1b; -TRUNCATE t1n; - -source include/show_binlog_events.inc; - -RESET MASTER; - -SET SESSION BINLOG_FORMAT=ROW; - -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); - -INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); -INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); - -error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE; -UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; - -# Not possible to test this since NDB writes its own binlog, which -# might cause it to be out of sync with the results from MyISAM. -# This will generate an error once BUG#28722 is fixed. - -#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; - -error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE; -UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; - -source include/show_binlog_events.inc; - -RESET MASTER; - -DROP TABLE t1m, t1b, t1n; - diff --git a/mysql-test/suite/binlog/t/binlog_old_versions.test b/mysql-test/suite/binlog/t/binlog_old_versions.test index 330aac137de..130101541e3 100644 --- a/mysql-test/suite/binlog/t/binlog_old_versions.test +++ b/mysql-test/suite/binlog/t/binlog_old_versions.test @@ -11,7 +11,7 @@ # The previous versions we currently test are: # - version 5.1.17 and earlier trees # - mysql-5.1-wl2325-xxx trees (AKA alcatel trees) -# - mysql-5.1-telco-6.1 trees (AKA ndb trees) +# - mysql-5.1-telco-6.1 trees # For completeness, we also test mysql-5.1-new_rpl, which is supposed # to be the "correct" version. @@ -75,7 +75,7 @@ SELECT COUNT(*) FROM t3; DROP TABLE t1, t3; ---echo ==== Read binlog from ndb tree (mysql-5.1-telco-6.1) ==== +--echo ==== Read binlog from telco tree (mysql-5.1-telco-6.1) ==== # Read binlog. --exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-telco.001 | $MYSQL --local-infile=1 diff --git a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test index 42d92e1a44d..98aa7635deb 100644 --- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test +++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_verbose.test @@ -1,12 +1,8 @@ ######################################################## -# Test mysqlbinlog command with Ndb produced Binlog -# variants -# # WHAT # ==== # This test aims to check that the mysqlbinlog --verbose -# command can output binlogs in 4 format variants, currently -# used by Ndb +# command can output binlogs in 4 format variants. # # 1) Updates logged as write_row events # Only primary key and updated columns included in the @@ -18,19 +14,6 @@ # event # 4) Updates logged as update_row events # All columns included in the event -# -# Format variant (1) is the Ndb default. -# Bug#47323 resulted in binlogs generated in format (1) -# being incorrectly parsed by the mysqlbinlog --verbose -# option -# -# HOW -# === -# Row-based binlog files in each format have been -# captured from an Ndb cluster -# These are output using the mysqlbinlog --verbose -# tool and the output is checked. -# ######################################################## # We require binlog_format_row as we're independent of binlog format diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test index 2de84a58875..c9e92e21002 100644 --- a/mysql-test/suite/binlog/t/binlog_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test @@ -96,10 +96,6 @@ # rpl.rpl_variables_stm tests the small subset of variables that # actually can be replicated safely in statement mode. # -# rpl_ndb.rpl_ndb_binlog_format_errors tests all errors and warnings -# related to logging format (not just 'Unsafe statement written to the -# binary log using statement format since BINLOG_FORMAT = STATEMENT'). - --source include/have_udf.inc --source include/have_log_bin.inc --source include/have_binlog_format_statement.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_bit.test b/mysql-test/suite/engines/funcs/t/rpl_bit.test index 07b0778296c..7f85313ae4c 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_bit.test +++ b/mysql-test/suite/engines/funcs/t/rpl_bit.test @@ -6,7 +6,6 @@ ############################################################################# # Change Author: JBM # Change Date: 2006-01-16 -# Change: Added Order by for NDB ########## -- source include/master-slave.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test index 6b23f1a0d03..adf1526a657 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test +++ b/mysql-test/suite/engines/funcs/t/rpl_err_ignoredtable.test @@ -2,8 +2,6 @@ # Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave # still checks that it has the same error as on the master. ########################################################################## -# 2006-02-07 JBM Added error code 1022 for NDB Engine + ORDER BY -########################################################################## -- source include/master-slave.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test index 97ee89a6d95..26235d89016 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_loadfile.test +++ b/mysql-test/suite/engines/funcs/t/rpl_loadfile.test @@ -6,7 +6,6 @@ ############################################################################# # Change Author: JBM # Change Date: 2006-01-16 -# Change: Added Order by for NDB ########## # Includes @@ -42,9 +41,6 @@ CALL test.p1(); --enable_warnings SELECT * FROM test.t1 ORDER BY blob_column; save_master_pos; -# Need to allow some time when NDB engine is used for -# the injector thread to have time to populate binlog -sleep 10; sync_slave_with_master; connection slave; SELECT * FROM test.t1 ORDER BY blob_column; diff --git a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test index 3a762b19756..22deee6b5f3 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test +++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test @@ -1,7 +1,6 @@ ########## # Change Author: JBM # Change Date: 2006-01-16 -# Change: Added Order by for NDB ########## # diff --git a/mysql-test/suite/engines/funcs/t/rpl_ps.test b/mysql-test/suite/engines/funcs/t/rpl_ps.test index b8792722192..09c7b779f65 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_ps.test +++ b/mysql-test/suite/engines/funcs/t/rpl_ps.test @@ -2,8 +2,6 @@ # Test of replicating user variables # ########################################################### -# 2006-02-08 By JBM added order by for use w/ NDB engine -########################################################### source include/master-slave.inc; #save_master_pos; diff --git a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test index 30d2688c3fb..f4e6239c679 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test +++ b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test @@ -1,5 +1,4 @@ -- source include/have_binlog_format_mixed.inc --- source include/not_ndb_default.inc -- source include/master-slave.inc # Test that the slave temporarily switches to ROW when seeing row diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test b/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test index ea4b958ae4c..3e057d48ec9 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_max_relay_size.test @@ -4,7 +4,6 @@ # Test of manual relay log rotation with FLUSH LOGS. # Requires statement logging -source include/not_ndb_default.inc; source include/have_binlog_format_row.inc; source extra/rpl_tests/rpl_max_relay_size.test; diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test index 054fa02f514..d8a5aacc5e6 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp005.test @@ -6,8 +6,6 @@ # Test: Tests SPs with cursors, flow logic, and alter sp. In addition the # # tests SPs with insert and update operations. # ############################################################################# -# 2006-02-08 By JBM added ORDER BY for use with NDB engine -############################################################################# # Includes -- source include/have_binlog_format_row.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test b/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test index 2a4b1e5e605..505ed582ba9 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_sp009.test @@ -5,8 +5,6 @@ ############################################################################# #TEST: Taken and modfied from http://bugs.mysql.com/bug.php?id=12168 # ############################################################################# -# 2006-02-08 By JBM : Added order by for ndb engine use -############################################################################# # Includes -- source include/have_binlog_format_row.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test index bf38bd487ea..b8223c5a196 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test @@ -1,4 +1,3 @@ --- source include/not_ndb_default.inc -- source include/have_binlog_format_row.inc -- source include/master-slave.inc diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_view01.test b/mysql-test/suite/engines/funcs/t/rpl_row_view01.test index 634e3c30cc6..1ccfcb4eb27 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_row_view01.test +++ b/mysql-test/suite/engines/funcs/t/rpl_row_view01.test @@ -5,8 +5,6 @@ ############################################################################# #TEST: row based replication of views # ############################################################################# -# 2006-02-08 By JBM added order by and sleep for use with ndb engine -############################################################################# # Includes -- source include/have_binlog_format_row.inc -- source include/master-slave.inc @@ -43,11 +41,6 @@ CREATE VIEW mysqltest1.v4 AS SELECT * FROM mysqltest1.v3 WHERE a > 1 WITH LOCAL SELECT * FROM mysqltest1.v2; SELECT * FROM mysqltest1.v1; -# Had to add a sleep for use with NDB -# engine. Injector thread would have not -# populated biblog and data would not be on -# the slave. -sleep 10; sync_slave_with_master; SELECT * FROM mysqltest1.v2; SELECT * FROM mysqltest1.v1; diff --git a/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test b/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test index c9c77f47d8d..94ce539291d 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test +++ b/mysql-test/suite/engines/funcs/t/rpl_sp_effects.test @@ -1,7 +1,6 @@ ########################################## # Change Author: JBM # Change Date: 2006-05-02 -# Change: Added Order By for NDB testing ########################################## # Test of replication of stored procedures (WL#2146 for MySQL 5.0) diff --git a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test index b9df07101fb..396ba4073e4 100644 --- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test @@ -1,4 +1,3 @@ --- source include/not_ndb_default.inc -- source include/master-slave.inc connection default; diff --git a/mysql-test/suite/engines/iuds/t/type_bit_iuds.test b/mysql-test/suite/engines/iuds/t/type_bit_iuds.test index 628457cb9cd..88418decfad 100644 --- a/mysql-test/suite/engines/iuds/t/type_bit_iuds.test +++ b/mysql-test/suite/engines/iuds/t/type_bit_iuds.test @@ -71,7 +71,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0)); CREATE TABLE t6(c1 BIT(0), c2 BIT(0)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -235,7 +234,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -359,7 +357,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1)); CREATE TABLE t6(c1 BIT(1), c2 BIT(1)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -523,7 +520,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -647,7 +643,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2)); CREATE TABLE t6(c1 BIT(2), c2 BIT(2)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -811,7 +806,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -935,7 +929,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4)); CREATE TABLE t6(c1 BIT(4), c2 BIT(4)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -1099,7 +1092,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -1223,7 +1215,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8)); CREATE TABLE t6(c1 BIT(8), c2 BIT(8)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -1387,7 +1378,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -1511,7 +1501,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16)); CREATE TABLE t6(c1 BIT(16), c2 BIT(16)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -1675,7 +1664,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -1799,7 +1787,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32)); CREATE TABLE t6(c1 BIT(32), c2 BIT(32)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -1963,7 +1950,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -2087,7 +2073,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64)); CREATE TABLE t6(c1 BIT(64), c2 BIT(64)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -2251,7 +2236,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -2375,7 +2359,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0)); CREATE TABLE t6(c1 BIT(0), c2 BIT(0)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -2539,7 +2522,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -2663,7 +2645,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1)); CREATE TABLE t6(c1 BIT(1), c2 BIT(1)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -2827,7 +2808,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -2951,7 +2931,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2)); CREATE TABLE t6(c1 BIT(2), c2 BIT(2)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -3115,7 +3094,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -3239,7 +3217,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4)); CREATE TABLE t6(c1 BIT(4), c2 BIT(4)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -3403,7 +3380,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -3527,7 +3503,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8)); CREATE TABLE t6(c1 BIT(8), c2 BIT(8)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -3691,7 +3666,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -3815,7 +3789,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16)); CREATE TABLE t6(c1 BIT(16), c2 BIT(16)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -3979,7 +3952,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -4103,7 +4075,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32)); CREATE TABLE t6(c1 BIT(32), c2 BIT(32)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -4267,7 +4238,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -4391,7 +4361,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64)); CREATE TABLE t6(c1 BIT(64), c2 BIT(64)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -4555,7 +4524,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -4679,7 +4647,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0)); CREATE TABLE t6(c1 BIT(0), c2 BIT(0)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -4843,7 +4810,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -4967,7 +4933,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1)); CREATE TABLE t6(c1 BIT(1), c2 BIT(1)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -5131,7 +5096,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -5255,7 +5219,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2)); CREATE TABLE t6(c1 BIT(2), c2 BIT(2)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -5419,7 +5382,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -5543,7 +5505,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4)); CREATE TABLE t6(c1 BIT(4), c2 BIT(4)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -5707,7 +5668,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -5831,7 +5791,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8)); CREATE TABLE t6(c1 BIT(8), c2 BIT(8)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -5995,7 +5954,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -6119,7 +6077,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16)); CREATE TABLE t6(c1 BIT(16), c2 BIT(16)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -6283,7 +6240,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -6407,7 +6363,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32)); CREATE TABLE t6(c1 BIT(32), c2 BIT(32)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -6571,7 +6526,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -6695,7 +6649,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64)); CREATE TABLE t6(c1 BIT(64), c2 BIT(64)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -6859,7 +6812,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -6983,7 +6935,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0)); CREATE TABLE t6(c1 BIT(0), c2 BIT(0)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -7147,7 +7098,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -7271,7 +7221,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1)); CREATE TABLE t6(c1 BIT(1), c2 BIT(1)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -7435,7 +7384,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -7559,7 +7507,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2)); CREATE TABLE t6(c1 BIT(2), c2 BIT(2)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -7723,7 +7670,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -7847,7 +7793,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4)); CREATE TABLE t6(c1 BIT(4), c2 BIT(4)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -8011,7 +7956,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -8135,7 +8079,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8)); CREATE TABLE t6(c1 BIT(8), c2 BIT(8)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -8299,7 +8242,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -8423,7 +8365,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16)); CREATE TABLE t6(c1 BIT(16), c2 BIT(16)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -8587,7 +8528,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -8711,7 +8651,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32)); CREATE TABLE t6(c1 BIT(32), c2 BIT(32)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -8875,7 +8814,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -8999,7 +8937,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64)); CREATE TABLE t6(c1 BIT(64), c2 BIT(64)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -9163,7 +9100,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -9287,7 +9223,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0)); CREATE TABLE t6(c1 BIT(0), c2 BIT(0)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -9451,7 +9386,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -9575,7 +9509,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1)); CREATE TABLE t6(c1 BIT(1), c2 BIT(1)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -9739,7 +9672,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -9863,7 +9795,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2)); CREATE TABLE t6(c1 BIT(2), c2 BIT(2)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -10027,7 +9958,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -10151,7 +10081,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4)); CREATE TABLE t6(c1 BIT(4), c2 BIT(4)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -10315,7 +10244,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -10439,7 +10367,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8)); CREATE TABLE t6(c1 BIT(8), c2 BIT(8)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -10603,7 +10530,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -10727,7 +10653,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16)); CREATE TABLE t6(c1 BIT(16), c2 BIT(16)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -10891,7 +10816,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -11015,7 +10939,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32)); CREATE TABLE t6(c1 BIT(32), c2 BIT(32)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -11179,7 +11102,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -11303,7 +11225,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64)); CREATE TABLE t6(c1 BIT(64), c2 BIT(64)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -11467,7 +11388,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -11591,7 +11511,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0)); CREATE TABLE t6(c1 BIT(0), c2 BIT(0)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -11755,7 +11674,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -11879,7 +11797,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1)); CREATE TABLE t6(c1 BIT(1), c2 BIT(1)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -12043,7 +11960,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -12167,7 +12083,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2)); CREATE TABLE t6(c1 BIT(2), c2 BIT(2)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -12331,7 +12246,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -12455,7 +12369,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4)); CREATE TABLE t6(c1 BIT(4), c2 BIT(4)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -12619,7 +12532,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -12743,7 +12655,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8)); CREATE TABLE t6(c1 BIT(8), c2 BIT(8)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -12907,7 +12818,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -13031,7 +12941,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16)); CREATE TABLE t6(c1 BIT(16), c2 BIT(16)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -13195,7 +13104,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -13319,7 +13227,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32)); CREATE TABLE t6(c1 BIT(32), c2 BIT(32)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -13483,7 +13390,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -13607,7 +13513,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64)); CREATE TABLE t6(c1 BIT(64), c2 BIT(64)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -13771,7 +13676,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -13896,7 +13800,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0)); CREATE TABLE t6(c1 BIT(0), c2 BIT(0)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -14060,7 +13963,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -14185,7 +14087,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1)); CREATE TABLE t6(c1 BIT(1), c2 BIT(1)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -14349,7 +14250,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -14474,7 +14374,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2)); CREATE TABLE t6(c1 BIT(2), c2 BIT(2)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -14638,7 +14537,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -14763,7 +14661,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4)); CREATE TABLE t6(c1 BIT(4), c2 BIT(4)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -14927,7 +14824,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -15052,7 +14948,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8)); CREATE TABLE t6(c1 BIT(8), c2 BIT(8)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -15216,7 +15111,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -15341,7 +15235,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16)); CREATE TABLE t6(c1 BIT(16), c2 BIT(16)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -15505,7 +15398,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -15630,7 +15522,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32)); CREATE TABLE t6(c1 BIT(32), c2 BIT(32)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -15794,7 +15685,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -15919,7 +15809,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64)); CREATE TABLE t6(c1 BIT(64), c2 BIT(64)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -16083,7 +15972,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -16208,7 +16096,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(0) NOT NULL PRIMARY KEY, c2 BIT(0)); CREATE TABLE t6(c1 BIT(0), c2 BIT(0)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -16372,7 +16259,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -16497,7 +16383,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(1) NOT NULL PRIMARY KEY, c2 BIT(1)); CREATE TABLE t6(c1 BIT(1), c2 BIT(1)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -16661,7 +16546,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -16786,7 +16670,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(2) NOT NULL PRIMARY KEY, c2 BIT(2)); CREATE TABLE t6(c1 BIT(2), c2 BIT(2)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -16950,7 +16833,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -17075,7 +16957,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(4) NOT NULL PRIMARY KEY, c2 BIT(4)); CREATE TABLE t6(c1 BIT(4), c2 BIT(4)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -17239,7 +17120,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -17364,7 +17244,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(8) NOT NULL PRIMARY KEY, c2 BIT(8)); CREATE TABLE t6(c1 BIT(8), c2 BIT(8)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -17528,7 +17407,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -17653,7 +17531,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(16) NOT NULL PRIMARY KEY, c2 BIT(16)); CREATE TABLE t6(c1 BIT(16), c2 BIT(16)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -17817,7 +17694,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -17942,7 +17818,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(32) NOT NULL PRIMARY KEY, c2 BIT(32)); CREATE TABLE t6(c1 BIT(32), c2 BIT(32)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -18106,7 +17981,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); @@ -18231,7 +18105,6 @@ CREATE TABLE t4(i INT, b BIT NOT NULL); ALTER TABLE t4 ADD PRIMARY KEY (i); CREATE TABLE t5(c1 BIT(64) NOT NULL PRIMARY KEY, c2 BIT(64)); CREATE TABLE t6(c1 BIT(64), c2 BIT(64)); -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); --sorted_result @@ -18395,7 +18268,6 @@ UPDATE t5,t6 SET t5.c2=t6.c1+t6.c2 WHERE t5.c1=t6.c1 AND t5.c2=t6.c2; TRUNCATE t5; TRUNCATE t6; -#Borrowed from suite/ndb/t/ndb_bitfield.test INSERT IGNORE INTO t5 VALUES (95, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (69, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135); INSERT INTO t6 VALUES (94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),(44, 307), (68, 454), (57, 135),(null,23),(1,null),(null,null); diff --git a/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl b/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl index 1164b471bd3..f277bce018e 100755 --- a/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl +++ b/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl @@ -108,7 +108,7 @@ $engine_options=""; add_engine_help(); } -# From this point forward there is no difference between the build in InnDB and the plugin +# From this point forward there is no difference between the build in InnoDB and the plugin $opt_engine='InnoDB' if ($opt_engine eq 'InnoDB_plugin'); # checking that custom files for that engine exist @@ -141,7 +141,6 @@ $cmd="MTR_VERSION=1 " . "--mysqld=--log-output=file " . "--mysqld=--sql-mode=no_engine_substitution " . "--skip-im " . - "--skip-ndb " . $engine_options . " > ".$runlog." 2>&1"; diff --git a/mysql-test/suite/federated/federatedx.test b/mysql-test/suite/federated/federatedx.test index 818cc2c1681..c4067070d14 100644 --- a/mysql-test/suite/federated/federatedx.test +++ b/mysql-test/suite/federated/federatedx.test @@ -1506,8 +1506,7 @@ DROP TABLE federated.test; # and lost changes to NEW variables. # Since for federated engine only operation which is affected by wrong # fields mark-up is handler::write_row() this file constains coverage -# for ON INSERT triggers only. Tests for other types of triggers reside -# in ndb_trigger.test. +# for ON INSERT triggers only. # connection slave; --disable_warnings diff --git a/mysql-test/suite/funcs_1/datadict/datadict_load.inc b/mysql-test/suite/funcs_1/datadict/datadict_load.inc index e3013249faf..9e3b87660f8 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict_load.inc +++ b/mysql-test/suite/funcs_1/datadict/datadict_load.inc @@ -61,15 +61,11 @@ let $SERVER_NAME= `SELECT DISTINCT host FROM mysql.user WHERE host NOT In ("loca eval SET @ENGINE_INNODB = IF( '$engine_type' = 'innodb', 1, 0); eval SET @ENGINE_MEMORY = IF( '$engine_type' = 'memory', 1, 0); eval SET @ENGINE_MYISAM = IF( '$engine_type' = 'myisam', 1, 0); -eval SET @ENGINE_NDB = IF( '$engine_type' = 'ndb', 1, 0); --enable_query_log let $engine_myisam= `SELECT @ENGINE_MYISAM = 1`; let $engine_innodb= `SELECT @ENGINE_INNODB = 1`; let $engine_memory= `SELECT @ENGINE_MEMORY = 1`; -let $engine_ndb= `SELECT @ENGINE_NDB = 1`; -# Note: The NDB variant with their own tb1 - tb4 tables is not ready for use. -let $engine_ndb= 0; --disable_warnings DROP DATABASE IF EXISTS test1; @@ -107,15 +103,5 @@ if ($engine_myisam) --source suite/funcs_1/include/myisam_tb2.inc } -if ($engine_ndb) -{ - --source suite/funcs_1/include/ndb_tb1.inc - --source suite/funcs_1/include/ndb_tb2.inc - --source suite/funcs_1/include/ndb_tb3.inc - --source suite/funcs_1/include/ndb_tb4.inc - USE test1; - --source suite/funcs_1/include/ndb_tb2.inc -} - USE test; --source suite/funcs_1/include/sp_tb.inc diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc index 2114e6f3126..ef00a6315f6 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc @@ -46,7 +46,6 @@ # ----> MyISAM # # - There is no impact of the GLOBAL(server) or SESSION default # # storage engine setting on the engine used for I_S tables. # -# That means we cannot get NDB or InnoDB instead. # # # # Creation: # # 2007-08 hhunger Implement this test as part of # diff --git a/mysql-test/suite/funcs_1/datadict/processlist_val.inc b/mysql-test/suite/funcs_1/datadict/processlist_val.inc index f5d736a8402..72c23fa89ed 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_val.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_val.inc @@ -20,7 +20,6 @@ # The column PROCESSLIST.INFO is of data type LONGTEXT ----> MyISAM # # - There is no impact of the GLOBAL(server) or SESSION default storage # # engine setting on the engine used for I_S tables. # -# That means we cannot get NDB or InnoDB instead. # # 3. The SHOW (FULL) PROCESSLIST command are for comparison. # # The main test target is INFORMATION_SCHEMA.PROCESSLIST ! # # 4. Attention: # diff --git a/mysql-test/suite/funcs_1/datadict/tables2.inc b/mysql-test/suite/funcs_1/datadict/tables2.inc index 0d110dd22d9..1dc00e5b0f7 100644 --- a/mysql-test/suite/funcs_1/datadict/tables2.inc +++ b/mysql-test/suite/funcs_1/datadict/tables2.inc @@ -21,13 +21,11 @@ # 20 CREATE_OPTIONS # 21 TABLE_COMMENT User defined comment # + InnoDB -# + NDB: "number_of_replicas: " appended # + InnoDB: "InnoDB free: kB" appended # depends on tablespace history! # The LEFT/INSTR/IF/LENGTH stuff should remove these # storage engine specific part. let $innodb_pattern = 'InnoDB free'; -let $ndb_pattern = 'number_of_replicas'; --vertical_results # We do not unify the engine name here, because the rowformat is # specific to the engine. @@ -36,11 +34,9 @@ let $ndb_pattern = 'number_of_replicas'; eval SELECT *, LEFT( table_comment, - IF(INSTR(table_comment,$innodb_pattern) = 0 - AND INSTR(table_comment,$ndb_pattern) = 0, + IF(INSTR(table_comment,$innodb_pattern) = 0, LENGTH(table_comment), - INSTR(table_comment,$innodb_pattern) - + INSTR(table_comment,$ndb_pattern) - 1)) + INSTR(table_comment,$innodb_pattern) - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/include/ndb_tb1.inc b/mysql-test/suite/funcs_1/include/ndb_tb1.inc deleted file mode 100644 index fd2db538b4c..00000000000 --- a/mysql-test/suite/funcs_1/include/ndb_tb1.inc +++ /dev/null @@ -1,70 +0,0 @@ -##### suite/funcs_1/include/ndb_tb1.inc - ---disable_warnings -drop table if exists tb1 ; ---enable_warnings -create table tb1 ( -f1 char(0), -f2 char(0) binary, -f3 char(0) ascii, -f4 tinytext unicode, -f5 text, -f6 mediumtext, -f7 longtext, -f8 tinyblob, -f9 blob, -f10 mediumblob, -f11 longblob, -f12 binary, -f13 tinyint, -f14 tinyint unsigned, -f15 tinyint zerofill, -f16 tinyint unsigned zerofill, -f17 smallint, -f18 smallint unsigned, -f19 smallint zerofill, -f20 smallint unsigned zerofill, -f21 mediumint, -f22 mediumint unsigned, -f23 mediumint zerofill, -f24 mediumint unsigned zerofill, -f25 int, -f26 int unsigned, -f27 int zerofill, -f28 int unsigned zerofill, -f29 bigint, -f30 bigint unsigned, -f31 bigint zerofill, -f32 bigint unsigned zerofill, -f33 decimal, -f34 decimal unsigned, -f35 decimal zerofill, -f36 decimal unsigned zerofill not null DEFAULT 9.9, -f37 decimal (0) not null DEFAULT 9.9, -f38 decimal (64) not null DEFAULT 9.9, -f39 decimal (0) unsigned not null DEFAULT 9.9, -f40 decimal (64) unsigned not null DEFAULT 9.9, -f41 decimal (0) zerofill not null DEFAULT 9.9, -f42 decimal (64) zerofill not null DEFAULT 9.9, -f43 decimal (0) unsigned zerofill not null DEFAULT 9.9, -f44 decimal (64) unsigned zerofill not null DEFAULT 9.9, -f45 decimal (0,0) not null DEFAULT 9.9, -f46 decimal (63,30) not null DEFAULT 9.9, -f47 decimal (0,0) unsigned not null DEFAULT 9.9, -f48 decimal (63,30) unsigned not null DEFAULT 9.9, -f49 decimal (0,0) zerofill not null DEFAULT 9.9, -f50 decimal (63,30) zerofill not null DEFAULT 9.9, -f51 decimal (0,0) unsigned zerofill not null DEFAULT 9.9, -f52 decimal (63,30) unsigned zerofill not null DEFAULT 9.9, -f53 numeric not null DEFAULT 99, -f54 numeric unsigned not null DEFAULT 99, -f55 numeric zerofill not null DEFAULT 99, -f56 numeric unsigned zerofill not null DEFAULT 99, -f57 numeric (0) not null DEFAULT 99, -f58 numeric (64) not null DEFAULT 99 -) engine = ndb; - ---replace_result $MYSQLTEST_VARDIR -eval -load data infile '$MYSQLTEST_VARDIR/std_data/funcs_1/ndb_tb1.txt' -into table tb1 ; diff --git a/mysql-test/suite/funcs_1/include/ndb_tb2.inc b/mysql-test/suite/funcs_1/include/ndb_tb2.inc deleted file mode 100644 index 3a8d647b65f..00000000000 --- a/mysql-test/suite/funcs_1/include/ndb_tb2.inc +++ /dev/null @@ -1,63 +0,0 @@ -##### suite/funcs_1/include/ndb_tb2.inc - ---disable_warnings -drop table if exists tb2 ; ---enable_warnings -create table tb2 ( -f59 numeric (0) unsigned, -f60 numeric (64) unsigned, -f61 numeric (0) zerofill, -f62 numeric (64) zerofill, -f63 numeric (0) unsigned zerofill, -f64 numeric (64) unsigned zerofill, -f65 numeric (0,0), -f66 numeric (63,30), -f67 numeric (0,0) unsigned, -f68 numeric (63,30) unsigned, -f69 numeric (0,0) zerofill, -f70 numeric (63,30) zerofill, -f71 numeric (0,0) unsigned zerofill, -f72 numeric (63,30) unsigned zerofill, -f73 real, -f74 real unsigned, -f75 real zerofill, -f76 real unsigned zerofill, -f77 double default 7.7, -f78 double unsigned default 7.7, -f79 double zerofill default 7.7, -f80 double unsigned zerofill default 8.8, -f81 float not null default 8.8, -f82 float unsigned not null default 8.8, -f83 float zerofill not null default 8.8, -f84 float unsigned zerofill not null default 8.8, -f85 float(0) not null default 8.8, -f86 float(23) not null default 8.8, -f87 float(0) unsigned not null default 8.8, -f88 float(23) unsigned not null default 8.8, -f89 float(0) zerofill not null default 8.8, -f90 float(23) zerofill not null default 8.8, -f91 float(0) unsigned zerofill not null default 8.8, -f92 float(23) unsigned zerofill not null default 8.8, -f93 float(24) not null default 8.8, -f94 float(53) not null default 8.8, -f95 float(24) unsigned not null default 8.8, -f96 float(53) unsigned not null default 8.8, -f97 float(24) zerofill not null default 8.8, -f98 float(53) zerofill not null default 8.8, -f99 float(24) unsigned zerofill not null default 8.8, -f100 float(53) unsigned zerofill not null default 8.8, -f101 date not null default '2000-01-01', -f102 time not null default 20, -f103 datetime not null default '2/2/2', -f104 timestamp not null default 20001231235959, -f105 year not null default 2000, -f106 year(3) not null default 2000, -f107 year(4) not null default 2000, -f108 enum("1enum","2enum") not null default "1enum", -f109 set("1set","2set") not null default "1set" -) engine = ndb; - ---replace_result $MYSQLTEST_VARDIR -eval -load data infile '$MYSQLTEST_VARDIR/std_data/funcs_1/ndb_tb2.txt' -into table tb2 ; diff --git a/mysql-test/suite/funcs_1/include/ndb_tb3.inc b/mysql-test/suite/funcs_1/include/ndb_tb3.inc deleted file mode 100644 index 6ade99bd1a2..00000000000 --- a/mysql-test/suite/funcs_1/include/ndb_tb3.inc +++ /dev/null @@ -1,70 +0,0 @@ -##### suite/funcs_1/include/ndb_tb3.inc - ---disable_warnings -drop table if exists tb3 ; ---enable_warnings -create table tb3 ( -f118 char not null DEFAULT 'a', -f119 char binary not null DEFAULT b'101', -f120 char ascii not null DEFAULT b'101', -f121 tinytext, -f122 text, -f123 mediumtext, -f124 longtext unicode, -f125 tinyblob, -f126 blob, -f127 mediumblob, -f128 longblob, -f129 binary not null DEFAULT b'101', -f130 tinyint not null DEFAULT 99, -f131 tinyint unsigned not null DEFAULT 99, -f132 tinyint zerofill not null DEFAULT 99, -f133 tinyint unsigned zerofill not null DEFAULT 99, -f134 smallint not null DEFAULT 999, -f135 smallint unsigned not null DEFAULT 999, -f136 smallint zerofill not null DEFAULT 999, -f137 smallint unsigned zerofill not null DEFAULT 999, -f138 mediumint not null DEFAULT 9999, -f139 mediumint unsigned not null DEFAULT 9999, -f140 mediumint zerofill not null DEFAULT 9999, -f141 mediumint unsigned zerofill not null DEFAULT 9999, -f142 int not null DEFAULT 99999, -f143 int unsigned not null DEFAULT 99999, -f144 int zerofill not null DEFAULT 99999, -f145 int unsigned zerofill not null DEFAULT 99999, -f146 bigint not null DEFAULT 999999, -f147 bigint unsigned not null DEFAULT 999999, -f148 bigint zerofill not null DEFAULT 999999, -f149 bigint unsigned zerofill not null DEFAULT 999999, -f150 decimal not null DEFAULT 999.999, -f151 decimal unsigned not null DEFAULT 999.17, -f152 decimal zerofill not null DEFAULT 999.999, -f153 decimal unsigned zerofill, -f154 decimal (0), -f155 decimal (64), -f156 decimal (0) unsigned, -f157 decimal (64) unsigned, -f158 decimal (0) zerofill, -f159 decimal (64) zerofill, -f160 decimal (0) unsigned zerofill, -f161 decimal (64) unsigned zerofill, -f162 decimal (0,0), -f163 decimal (63,30), -f164 decimal (0,0) unsigned, -f165 decimal (63,30) unsigned, -f166 decimal (0,0) zerofill, -f167 decimal (63,30) zerofill, -f168 decimal (0,0) unsigned zerofill, -f169 decimal (63,30) unsigned zerofill, -f170 numeric, -f171 numeric unsigned, -f172 numeric zerofill, -f173 numeric unsigned zerofill, -f174 numeric (0), -f175 numeric (64) -) engine = ndb; - ---replace_result $MYSQLTEST_VARDIR -eval -load data infile '$MYSQLTEST_VARDIR/std_data/funcs_1/ndb_tb3.txt' -into table tb3; diff --git a/mysql-test/suite/funcs_1/include/ndb_tb4.inc b/mysql-test/suite/funcs_1/include/ndb_tb4.inc deleted file mode 100644 index 3eaae90179a..00000000000 --- a/mysql-test/suite/funcs_1/include/ndb_tb4.inc +++ /dev/null @@ -1,70 +0,0 @@ -##### suite/funcs_1/include/ndb_tb4.inc - ---disable_warnings -drop table if exists tb4; ---enable_warnings -create table tb4 ( -f176 numeric (0) unsigned not null DEFAULT 9, -f177 numeric (64) unsigned not null DEFAULT 9, -f178 numeric (0) zerofill not null DEFAULT 9, -f179 numeric (64) zerofill not null DEFAULT 9, -f180 numeric (0) unsigned zerofill not null DEFAULT 9, -f181 numeric (64) unsigned zerofill not null DEFAULT 9, -f182 numeric (0,0) not null DEFAULT 9, -f183 numeric (63,30) not null DEFAULT 9, -f184 numeric (0,0) unsigned not null DEFAULT 9, -f185 numeric (63,30) unsigned not null DEFAULT 9, -f186 numeric (0,0) zerofill not null DEFAULT 9, -f187 numeric (63,30) zerofill not null DEFAULT 9, -f188 numeric (0,0) unsigned zerofill not null DEFAULT 9, -f189 numeric (63,30) unsigned zerofill not null DEFAULT 9, -f190 real not null DEFAULT 88.8, -f191 real unsigned not null DEFAULT 88.8, -f192 real zerofill not null DEFAULT 88.8, -f193 real unsigned zerofill not null DEFAULT 88.8, -f194 double not null DEFAULT 55.5, -f195 double unsigned not null DEFAULT 55.5, -f196 double zerofill not null DEFAULT 55.5, -f197 double unsigned zerofill not null DEFAULT 55.5, -f198 float, -f199 float unsigned, -f200 float zerofill, -f201 float unsigned zerofill, -f202 float(0), -f203 float(23), -f204 float(0) unsigned, -f205 float(23) unsigned, -f206 float(0) zerofill, -f207 float(23) zerofill, -f208 float(0) unsigned zerofill, -f209 float(23) unsigned zerofill, -f210 float(24), -f211 float(53), -f212 float(24) unsigned, -f213 float(53) unsigned, -f214 float(24) zerofill, -f215 float(53) zerofill, -f216 float(24) unsigned zerofill, -f217 float(53) unsigned zerofill, -f218 date, -f219 time, -f220 datetime, -f221 timestamp, -f222 year, -f223 year(3), -f224 year(4), -f225 enum("1enum","2enum"), -f226 set("1set","2set"), -f235 char(0) unicode, -f236 char(90), -f237 char(255) ascii, -f238 varchar(0), -f239 varchar(3000) binary, -f240 varchar(2000) unicode, -f241 char(100) unicode -) engine = ndb; - ---replace_result $MYSQLTEST_VARDIR -eval -load data infile '$MYSQLTEST_VARDIR/std_data/funcs_1/ndb_tb4.txt' -into table tb4 ; diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 8f2f81a4616..342ac491c41 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -36,6 +36,7 @@ def information_schema CLIENT_STATISTICS CPU_TIME 6 0 NO double NULL NULL 21 NUL def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 20 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema CLIENT_STATISTICS EMPTY_QUERIES 23 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select +def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema CLIENT_STATISTICS OTHER_COMMANDS 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 19 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema CLIENT_STATISTICS ROWS_DELETED 12 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select @@ -45,6 +46,7 @@ def information_schema CLIENT_STATISTICS ROWS_SENT 11 0 NO bigint NULL NULL 19 0 def information_schema CLIENT_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema CLIENT_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS 2 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select +def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema COLLATIONS CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select def information_schema COLLATIONS COLLATION_NAME 1 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select @@ -151,9 +153,9 @@ def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select def information_schema INDEX_STATISTICS INDEX_NAME 3 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema INDEX_STATISTICS TABLE_NAME 2 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select @@ -304,9 +306,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select -def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL NULL utf8 utf8_general_ci varchar(1) select def information_schema STATISTICS COLUMN_NAME 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select @@ -323,6 +325,20 @@ def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NUL def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select +def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select +def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select +def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) select +def information_schema SYSTEM_VARIABLES READ_ONLY 13 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) select +def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) select +def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select +def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select +def information_schema SYSTEM_VARIABLES VARIABLE_TYPE 7 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select @@ -408,6 +424,7 @@ def information_schema USER_STATISTICS CPU_TIME 6 0 NO double NULL NULL 21 NULL def information_schema USER_STATISTICS DENIED_CONNECTIONS 20 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema USER_STATISTICS EMPTY_QUERIES 23 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema USER_STATISTICS LOST_CONNECTIONS 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select +def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema USER_STATISTICS OTHER_COMMANDS 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 19 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema USER_STATISTICS ROWS_DELETED 12 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select @@ -417,6 +434,7 @@ def information_schema USER_STATISTICS ROWS_SENT 11 0 NO bigint NULL NULL 19 0 N def information_schema USER_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema USER_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) select +def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 24 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select def information_schema USER_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select def information_schema USER_STATISTICS USER 1 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select def information_schema VIEWS CHARACTER_SET_CLIENT 9 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select @@ -533,6 +551,8 @@ NULL information_schema CLIENT_STATISTICS DENIED_CONNECTIONS bigint NULL NULL NU NULL information_schema CLIENT_STATISTICS LOST_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS ACCESS_DENIED bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS EMPTY_QUERIES bigint NULL NULL NULL NULL bigint(21) +NULL information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) unsigned +NULL information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED bigint NULL NULL NULL NULL bigint(21) 3.0000 information_schema COLLATIONS COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema COLLATIONS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) NULL information_schema COLLATIONS ID bigint NULL NULL NULL NULL bigint(11) @@ -810,6 +830,20 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3) 3.0000 information_schema STATISTICS INDEX_TYPE varchar 16 48 utf8 utf8_general_ci varchar(16) 3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16) 3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES VARIABLE_SCOPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SYSTEM_VARIABLES VARIABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SYSTEM_VARIABLES VARIABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048) +3.0000 information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE varchar 21 63 utf8 utf8_general_ci varchar(21) +3.0000 information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE varchar 21 63 utf8 utf8_general_ci varchar(21) +3.0000 information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE varchar 21 63 utf8 utf8_general_ci varchar(21) +1.0000 information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema SYSTEM_VARIABLES READ_ONLY varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) @@ -906,6 +940,8 @@ NULL information_schema USER_STATISTICS DENIED_CONNECTIONS bigint NULL NULL NULL NULL information_schema USER_STATISTICS LOST_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS ACCESS_DENIED bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS EMPTY_QUERIES bigint NULL NULL NULL NULL bigint(21) +NULL information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) unsigned +NULL information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED bigint NULL NULL NULL NULL bigint(21) 3.0000 information_schema VIEWS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema VIEWS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema VIEWS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index f46f1c0ce62..75e05215569 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -36,6 +36,7 @@ def information_schema CLIENT_STATISTICS CPU_TIME 6 0 NO double NULL NULL 21 NUL def information_schema CLIENT_STATISTICS DENIED_CONNECTIONS 20 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema CLIENT_STATISTICS EMPTY_QUERIES 23 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema CLIENT_STATISTICS LOST_CONNECTIONS 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) +def information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema CLIENT_STATISTICS OTHER_COMMANDS 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema CLIENT_STATISTICS ROLLBACK_TRANSACTIONS 19 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema CLIENT_STATISTICS ROWS_DELETED 12 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) @@ -45,6 +46,7 @@ def information_schema CLIENT_STATISTICS ROWS_SENT 11 0 NO bigint NULL NULL 19 0 def information_schema CLIENT_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema CLIENT_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS 2 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) +def information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS 24 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def information_schema CLIENT_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema COLLATIONS CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) def information_schema COLLATIONS COLLATION_NAME 1 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) @@ -151,9 +153,9 @@ def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema GLOBAL_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) def information_schema INDEX_STATISTICS INDEX_NAME 3 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema INDEX_STATISTICS TABLE_NAME 2 NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) @@ -304,9 +306,9 @@ def information_schema SCHEMA_PRIVILEGES PRIVILEGE_TYPE 4 NO varchar 64 192 NUL def information_schema SCHEMA_PRIVILEGES TABLE_CATALOG 2 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) def information_schema SCHEMA_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema SESSION_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema SESSION_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SESSION_STATUS VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) def information_schema SESSION_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SESSION_VARIABLES VARIABLE_VALUE 2 NO varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL NULL utf8 utf8_general_ci varchar(1) def information_schema STATISTICS COLUMN_NAME 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) @@ -323,6 +325,20 @@ def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NUL def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT 14 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema SYSTEM_VARIABLES DEFAULT_VALUE 5 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST 12 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext +def information_schema SYSTEM_VARIABLES GLOBAL_VALUE 3 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN 4 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE 11 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) +def information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE 10 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) +def information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE 9 NULL YES varchar 21 63 NULL NULL NULL utf8 utf8_general_ci varchar(21) +def information_schema SYSTEM_VARIABLES READ_ONLY 13 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) +def information_schema SYSTEM_VARIABLES SESSION_VALUE 2 NULL YES varchar 1024 3072 NULL NULL NULL utf8 utf8_general_ci varchar(1024) +def information_schema SYSTEM_VARIABLES VARIABLE_COMMENT 8 NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) +def information_schema SYSTEM_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema SYSTEM_VARIABLES VARIABLE_SCOPE 6 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) +def information_schema SYSTEM_VARIABLES VARIABLE_TYPE 7 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned @@ -408,6 +424,7 @@ def information_schema USER_STATISTICS CPU_TIME 6 0 NO double NULL NULL 21 NULL def information_schema USER_STATISTICS DENIED_CONNECTIONS 20 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema USER_STATISTICS EMPTY_QUERIES 23 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema USER_STATISTICS LOST_CONNECTIONS 21 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) +def information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED 25 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema USER_STATISTICS OTHER_COMMANDS 17 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema USER_STATISTICS ROLLBACK_TRANSACTIONS 19 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema USER_STATISTICS ROWS_DELETED 12 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) @@ -417,6 +434,7 @@ def information_schema USER_STATISTICS ROWS_SENT 11 0 NO bigint NULL NULL 19 0 N def information_schema USER_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema USER_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) +def information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS 24 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def information_schema USER_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) def information_schema USER_STATISTICS USER 1 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) def information_schema VIEWS CHARACTER_SET_CLIENT 9 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) @@ -533,6 +551,8 @@ NULL information_schema CLIENT_STATISTICS DENIED_CONNECTIONS bigint NULL NULL NU NULL information_schema CLIENT_STATISTICS LOST_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS ACCESS_DENIED bigint NULL NULL NULL NULL bigint(21) NULL information_schema CLIENT_STATISTICS EMPTY_QUERIES bigint NULL NULL NULL NULL bigint(21) +NULL information_schema CLIENT_STATISTICS TOTAL_SSL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) unsigned +NULL information_schema CLIENT_STATISTICS MAX_STATEMENT_TIME_EXCEEDED bigint NULL NULL NULL NULL bigint(21) 3.0000 information_schema COLLATIONS COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema COLLATIONS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) NULL information_schema COLLATIONS ID bigint NULL NULL NULL NULL bigint(11) @@ -810,6 +830,20 @@ NULL information_schema STATISTICS SUB_PART bigint NULL NULL NULL NULL bigint(3) 3.0000 information_schema STATISTICS INDEX_TYPE varchar 16 48 utf8 utf8_general_ci varchar(16) 3.0000 information_schema STATISTICS COMMENT varchar 16 48 utf8 utf8_general_ci varchar(16) 3.0000 information_schema STATISTICS INDEX_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES VARIABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SYSTEM_VARIABLES SESSION_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES GLOBAL_VALUE_ORIGIN varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SYSTEM_VARIABLES DEFAULT_VALUE varchar 1024 3072 utf8 utf8_general_ci varchar(1024) +3.0000 information_schema SYSTEM_VARIABLES VARIABLE_SCOPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SYSTEM_VARIABLES VARIABLE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64) +3.0000 information_schema SYSTEM_VARIABLES VARIABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048) +3.0000 information_schema SYSTEM_VARIABLES NUMERIC_MIN_VALUE varchar 21 63 utf8 utf8_general_ci varchar(21) +3.0000 information_schema SYSTEM_VARIABLES NUMERIC_MAX_VALUE varchar 21 63 utf8 utf8_general_ci varchar(21) +3.0000 information_schema SYSTEM_VARIABLES NUMERIC_BLOCK_SIZE varchar 21 63 utf8 utf8_general_ci varchar(21) +1.0000 information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST longtext 4294967295 4294967295 utf8 utf8_general_ci longtext +3.0000 information_schema SYSTEM_VARIABLES READ_ONLY varchar 3 9 utf8 utf8_general_ci varchar(3) +3.0000 information_schema SYSTEM_VARIABLES COMMAND_LINE_ARGUMENT varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema TABLES TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema TABLES TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) @@ -906,6 +940,8 @@ NULL information_schema USER_STATISTICS DENIED_CONNECTIONS bigint NULL NULL NULL NULL information_schema USER_STATISTICS LOST_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS ACCESS_DENIED bigint NULL NULL NULL NULL bigint(21) NULL information_schema USER_STATISTICS EMPTY_QUERIES bigint NULL NULL NULL NULL bigint(21) +NULL information_schema USER_STATISTICS TOTAL_SSL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21) unsigned +NULL information_schema USER_STATISTICS MAX_STATEMENT_TIME_EXCEEDED bigint NULL NULL NULL NULL bigint(21) 3.0000 information_schema VIEWS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) 3.0000 information_schema VIEWS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema VIEWS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index d05c120bfa8..09adebfab1c 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -227,6 +227,7 @@ def mysql user is_role 44 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum def mysql user Lock_tables_priv 21 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references def mysql user max_connections 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references def mysql user max_questions 37 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references +def mysql user max_statement_time 46 0.000000 NO decimal NULL NULL 12 6 NULL NULL NULL decimal(12,6) select,insert,update,references def mysql user max_updates 38 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references def mysql user max_user_connections 40 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references def mysql user Password 3 NO char 41 41 NULL NULL NULL latin1 latin1_bin char(41) select,insert,update,references @@ -568,3 +569,4 @@ NULL mysql user max_user_connections int NULL NULL NULL NULL int(11) 3.0000 mysql user password_expired enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql user default_role char 80 240 utf8 utf8_bin char(80) +NULL mysql user max_statement_time decimal NULL NULL NULL NULL decimal(12,6) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 4f609bbcbd0..7304f76562f 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -227,6 +227,7 @@ def mysql user is_role 44 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum def mysql user Lock_tables_priv 21 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') def mysql user max_connections 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned def mysql user max_questions 37 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned +def mysql user max_statement_time 46 0.000000 NO decimal NULL NULL 12 6 NULL NULL NULL decimal(12,6) def mysql user max_updates 38 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned def mysql user max_user_connections 40 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql user Password 3 NO char 41 41 NULL NULL NULL latin1 latin1_bin char(41) @@ -568,3 +569,4 @@ NULL mysql user max_user_connections int NULL NULL NULL NULL int(11) 3.0000 mysql user password_expired enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql user default_role char 80 240 utf8 utf8_bin char(80) +NULL mysql user max_statement_time decimal NULL NULL NULL NULL decimal(12,6) diff --git a/mysql-test/suite/funcs_1/r/is_tables_innodb.result b/mysql-test/suite/funcs_1/r/is_tables_innodb.result index bc984b1b6fe..204ee893fd8 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_innodb.result +++ b/mysql-test/suite/funcs_1/r/is_tables_innodb.result @@ -7,11 +7,9 @@ CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = ; CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = ; SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -99,11 +97,9 @@ GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/r/is_tables_is.result b/mysql-test/suite/funcs_1/r/is_tables_is.result index 5ecac2f296f..f88afbbdf5a 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is.result @@ -2,11 +2,9 @@ DROP DATABASE IF EXISTS test1; CREATE DATABASE test1; SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -660,6 +658,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME SYSTEM_VARIABLES +TABLE_TYPE SYSTEM VIEW +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME TABLES TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -871,11 +892,9 @@ GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -1529,6 +1548,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME SYSTEM_VARIABLES +TABLE_TYPE SYSTEM VIEW +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME TABLES TABLE_TYPE SYSTEM VIEW ENGINE MEMORY diff --git a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result index 5ecac2f296f..f88afbbdf5a 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result @@ -2,11 +2,9 @@ DROP DATABASE IF EXISTS test1; CREATE DATABASE test1; SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -660,6 +658,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME SYSTEM_VARIABLES +TABLE_TYPE SYSTEM VIEW +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME TABLES TABLE_TYPE SYSTEM VIEW ENGINE MEMORY @@ -871,11 +892,9 @@ GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -1529,6 +1548,29 @@ user_comment Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA information_schema +TABLE_NAME SYSTEM_VARIABLES +TABLE_TYPE SYSTEM VIEW +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_general_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA information_schema TABLE_NAME TABLES TABLE_TYPE SYSTEM VIEW ENGINE MEMORY diff --git a/mysql-test/suite/funcs_1/r/is_tables_memory.result b/mysql-test/suite/funcs_1/r/is_tables_memory.result index 961fb98d573..acf6636cd38 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_memory.result +++ b/mysql-test/suite/funcs_1/r/is_tables_memory.result @@ -8,11 +8,9 @@ CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = ; CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = ; SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -100,11 +98,9 @@ GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/r/is_tables_myisam.result b/mysql-test/suite/funcs_1/r/is_tables_myisam.result index 1afb80ca3d7..5ef3fbaafab 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_myisam.result +++ b/mysql-test/suite/funcs_1/r/is_tables_myisam.result @@ -8,11 +8,9 @@ CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = ; CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = ; SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -100,11 +98,9 @@ GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result index ddf98bbded8..3ffa2662313 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result @@ -8,11 +8,9 @@ CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = ; CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = ; SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -100,11 +98,9 @@ GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result index 1eeaba15838..430c7fe2580 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result @@ -2,11 +2,9 @@ DROP DATABASE IF EXISTS test1; CREATE DATABASE test1; SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -708,11 +706,9 @@ GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result index 6c0b0db07eb..f1a6cc327b7 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result @@ -2,11 +2,9 @@ DROP DATABASE IF EXISTS test1; CREATE DATABASE test1; SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables @@ -708,11 +706,9 @@ GRANT SELECT ON test1.* TO testuser1@localhost; # Establish connection testuser1 (user=testuser1) SELECT *, LEFT( table_comment, -IF(INSTR(table_comment,'InnoDB free') = 0 -AND INSTR(table_comment,'number_of_replicas') = 0, +IF(INSTR(table_comment,'InnoDB free') = 0, LENGTH(table_comment), -INSTR(table_comment,'InnoDB free') -+ INSTR(table_comment,'number_of_replicas') - 1)) +INSTR(table_comment,'InnoDB free') - 1)) AS "user_comment", '-----------------------------------------------------' AS "Separator" FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/r/is_user_privileges.result b/mysql-test/suite/funcs_1/r/is_user_privileges.result index 5296a37c98d..dfbe50ad862 100644 --- a/mysql-test/suite/funcs_1/r/is_user_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result @@ -132,6 +132,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 Host localhost User testuser2 Password @@ -177,6 +178,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 Host localhost User testuser3 Password @@ -222,6 +224,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 # # Add GRANT OPTION db_datadict.* to testuser1; GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION; @@ -291,6 +294,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 Host localhost User testuser2 Password @@ -336,6 +340,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 Host localhost User testuser3 Password @@ -381,6 +386,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 # Establish connection testuser1 (user=testuser1) SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -436,6 +442,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 Host localhost User testuser2 Password @@ -481,6 +488,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 Host localhost User testuser3 Password @@ -526,6 +534,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO 'testuser1'@'localhost' @@ -603,6 +612,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 Host localhost User testuser2 Password @@ -648,6 +658,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 Host localhost User testuser3 Password @@ -693,6 +704,7 @@ authentication_string password_expired N is_role N default_role +max_statement_time 0.000000 GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION; # # Here