mariadb/cmd-line-utils/readline
Davi Arnaut 0eb26fdfa8 Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.

One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.

There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.

BUILD/SETUP.sh:
  Remove flags that are implied by -Wall and -Wextra.
  Do not warn about unused parameters in C++.
BUILD/check-cpu:
  Print only the compiler version instead of verbose banner.
  Although the option is gcc specific, the check was only
  being used for GCC specific checks anyway.
client/mysql.cc:
  bcmp is no longer defined.
client/mysqltest.cc:
  Pass a string to function expecting a format string.
  Replace use of bcmp with memcmp.
cmd-line-utils/readline/Makefile.am:
  Always define _GNU_SOURCE when compiling GNU readline.
  Required to make certain prototypes visible.
cmd-line-utils/readline/input.c:
  Condition for the code to be meaningful.
configure.in:
  Remove check for bcmp.
extra/comp_err.c:
  Use appropriate type.
extra/replace.c:
  Replace use of bcmp with memcmp.
extra/yassl/src/crypto_wrapper.cpp:
  Do not ignore the return value of fgets. Retrieve the file
  position if fgets succeed -- if it fails, the function will
  bail out and return a error.
extra/yassl/taocrypt/include/blowfish.hpp:
  Use a single array instead of accessing positions of the sbox_
  through a subscript to pbox_.
extra/yassl/taocrypt/include/runtime.hpp:
  One definition of such functions is enough.
extra/yassl/taocrypt/src/aes.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/algebra.cpp:
  Rename arguments to avoid shadowing related warnings.
extra/yassl/taocrypt/src/blowfish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/taocrypt/src/integer.cpp:
  Do not define type within a anonymous union.
  Use a variable to return a value instead of
  leaving the result in a register -- compiler
  does not know the logic inside the asm.
extra/yassl/taocrypt/src/misc.cpp:
  Define handler for pure virtual functions.
  Remove unused code.
extra/yassl/taocrypt/src/twofish.cpp:
  Avoid potentially ambiguous conditions.
extra/yassl/testsuite/test.hpp:
  Function must have C language linkage.
include/m_string.h:
  Remove check which relied on bcmp being defined -- they weren't
  being used as bcmp is only visible when _BSD_SOURCE is defined.
include/my_bitmap.h:
  Remove bogus helpers which were used only in a few files and
  were causing warnings about dead code.
include/my_global.h:
  Due to G++ bug, always silence false-positive uninitialized
  variables warnings when compiling C++ code with G++.
  Remove bogus helper.
libmysql/Makefile.shared:
  Remove built-in implementation of bcmp.
mysql-test/lib/My/SafeProcess/safe_process.cc:
  Cast pid to largest possible type for a process identifier.
mysys/mf_loadpath.c:
  Leave space of the ending nul.
mysys/mf_pack.c:
  Replace bcmp with memcmp.
mysys/my_bitmap.c:
  Dead code removal.
mysys/my_gethwaddr.c:
  Remove unused variable.
mysys/my_getopt.c:
  Silence bogus uninitialized variable warning.
  Do not cast away the constant qualifier.
mysys/safemalloc.c:
  Cast to expected type.
mysys/thr_lock.c:
  Silence bogus uninitialized variable warning.
sql/field.cc:
  Replace bogus helper with a more appropriate logic which is
  used throughout the code.
sql/item.cc:
  Remove bogus logical condition which always evaluates to TRUE.
sql/item_create.cc:
  Simplify code to avoid signedness related warnings.
sql/log_event.cc:
  Replace use of bcmp with memcmp.
  No need to use helpers for simple bit operations.
sql/log_event_old.cc:
  Replace bmove_align with memcpy.
sql/mysqld.cc:
  Move use declaration of variable to the ifdef block where it
  is used. Remove now-unnecessary casts and arguments.
sql/set_var.cc:
  Replace bogus helpers with simple and classic bit operations.
sql/slave.cc:
  Cast to expected type and silence bogus warning.
sql/sql_class.h:
  Don't use enum values as bit flags, the supposed type safety is
  bogus as the combined bit flags are not a value in the enumeration.
sql/udf_example.c:
  Only declare variable when necessary.
sql/unireg.h:
  Replace use of bmove_align with memcpy.
storage/innobase/os/os0file.c:
  Silence bogus warning.
storage/myisam/mi_open.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
storage/myisam/mi_page.c:
  Remove bogus cast, DBUG_DUMP expects a pointer to unsigned
  char.
strings/bcmp.c:
  Remove built-in bcmp.
strings/ctype-ucs2.c:
  Silence bogus warning.
tests/mysql_client_test.c:
  Use a appropriate type as expected by simple_command().
2010-07-02 15:30:47 -03:00
..
.cvsignore move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
ansi_stdlib.h move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
bind.c Merge from 5.0 for 43414 2009-08-28 18:21:54 +02:00
callback.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
chardefs.h Addendum to Bug #45286: backport macro name form other tree 2009-06-06 15:05:44 +02:00
compat.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
complete.c Merge from 5.0 2009-06-29 16:00:47 +02:00
config_readline.h After review fix 2005-04-20 12:02:07 +02:00
configure.in Update readline to version 5.2. This fixes bug#18431. 2007-11-19 14:38:08 +01:00
COPYING move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
display.c Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
emacs_keymap.c move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
funmap.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
histexpand.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
histfile.c Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-08-28 17:51:31 +02:00
histlib.h move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
history.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
history.h Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
histsearch.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
input.c Bug#53445: Build with -Wall and fix warnings that it generates 2010-07-02 15:30:47 -03:00
INSTALL Update readline to version 5.2. This fixes bug#18431. 2007-11-19 14:38:08 +01:00
isearch.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
keymaps.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
keymaps.h move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
kill.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
macro.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
Makefile.am Bug#53445: Build with -Wall and fix warnings that it generates 2010-07-02 15:30:47 -03:00
mbutil.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
misc.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
nls.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
parens.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
posixdir.h Upgrade bundled readline to version 5.0. 2005-07-18 17:22:38 -07:00
posixjmp.h move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
posixstat.h move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
readline.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
readline.h Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
README Update readline to version 5.2. This fixes bug#18431. 2007-11-19 14:38:08 +01:00
rlconf.h Update readline to version 5.2. This fixes bug#18431. 2007-11-19 14:38:08 +01:00
rldefs.h use correct config_readline.h file 2008-01-03 14:26:41 +01:00
rlmbutil.h Bug #43414 Parenthesis (and other) warnings compiling 2010-02-22 14:23:47 +01:00
rlprivate.h Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
rlshell.h move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00
rlstdc.h Upgrade bundled readline to version 5.0. 2005-07-18 17:22:38 -07:00
rltty.c Merge from 5.0 2009-06-29 16:00:47 +02:00
rltty.h Upgrade bundled readline to version 5.0. 2005-07-18 17:22:38 -07:00
rltypedefs.h Upgrade bundled readline to version 5.0. 2005-07-18 17:22:38 -07:00
rlwinsize.h use correct config_readline.h file 2008-01-03 14:26:41 +01:00
savestring.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
search.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
shell.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
signals.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
tcap.h use correct config_readline.h file 2008-01-03 14:26:41 +01:00
terminal.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
text.c Bug #43414 Parenthesis (and other) warnings compiling 2010-02-22 14:23:47 +01:00
tilde.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
tilde.h Update readline to version 5.2. This fixes bug#18431. 2007-11-19 14:38:08 +01:00
undo.c Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-08-28 17:51:31 +02:00
util.c Build fixes for Windows, AIX, HP/UX and Sun Studio11, from Timothy Smith. 2009-08-14 17:18:52 +02:00
vi_keymap.c Update readline to version 5.2. This fixes bug#18431. 2007-11-19 14:38:08 +01:00
vi_mode.c Merge from 5.0-bt 2009-06-29 15:17:01 +02:00
xmalloc.c use correct config_readline.h file 2008-01-03 14:26:41 +01:00
xmalloc.h move readline to cmd-line-utils 2003-01-18 20:53:46 +04:00

Introduction
============

This is the Gnu Readline library, version 5.2.

The Readline library provides a set of functions for use by applications
that allow users to edit command lines as they are typed in.  Both
Emacs and vi editing modes are available.  The Readline library includes
additional functions to maintain a list of previously-entered command
lines, to recall and perhaps reedit those lines, and perform csh-like
history expansion on previous commands.

The history facilites are also placed into a separate library, the
History library, as part of the build process.  The History library
may be used without Readline in applications which desire its
capabilities.

The Readline library is free software, distributed under the terms of
the [GNU] General Public License, version 2.  For more information, see
the file COPYING.

To build the library, try typing `./configure', then `make'.  The
configuration process is automated, so no further intervention should
be necessary.  Readline builds with `gcc' by default if it is
available.  If you want to use `cc' instead, type

        CC=cc ./configure

if you are using a Bourne-style shell.  If you are not, the following
may work:

        env CC=cc ./configure

Read the file INSTALL in this directory for more information about how
to customize and control the build process.

The file rlconf.h contains C preprocessor defines that enable and disable
certain Readline features.

The special make target `everything' will build the static and shared
libraries (if the target platform supports them) and the examples.

Examples
========

There are several example programs that use Readline features in the
examples directory.  The `rl' program is of particular interest.  It
is a command-line interface to Readline, suitable for use in shell
scripts in place of `read'.

Shared Libraries
================

There is skeletal support for building shared versions of the
Readline and History libraries.  The configure script creates
a Makefile in the `shlib' subdirectory, and typing `make shared'
will cause shared versions of the Readline and History libraries
to be built on supported platforms.

If `configure' is given the `--enable-shared' option, it will attempt
to build the shared libraries by default on supported platforms.

Configure calls the script support/shobj-conf to test whether or
not shared library creation is supported and to generate the values
of variables that are substituted into shlib/Makefile.  If you
try to build shared libraries on an unsupported platform, `make'
will display a message asking you to update support/shobj-conf for
your platform.

If you need to update support/shobj-conf, you will need to create
a `stanza' for your operating system and compiler.  The script uses
the value of host_os and ${CC} as determined by configure.  For
instance, FreeBSD 4.2 with any version of gcc is identified as
`freebsd4.2-gcc*'.

In the stanza for your operating system-compiler pair, you will need to
define several variables.  They are:

SHOBJ_CC	The C compiler used to compile source files into shareable
		object files.  This is normally set to the value of ${CC}
		by configure, and should not need to be changed.

SHOBJ_CFLAGS	Flags to pass to the C compiler ($SHOBJ_CC) to create
		position-independent code.  If you are using gcc, this
		should probably be set to `-fpic'.

SHOBJ_LD	The link editor to be used to create the shared library from
		the object files created by $SHOBJ_CC.  If you are using
		gcc, a value of `gcc' will probably work.

SHOBJ_LDFLAGS	Flags to pass to SHOBJ_LD to enable shared object creation.
		If you are using gcc, `-shared' may be all that is necessary.
		These should be the flags needed for generic shared object
		creation.

SHLIB_XLDFLAGS	Additional flags to pass to SHOBJ_LD for shared library
		creation.  Many systems use the -R option to the link
		editor to embed a path within the library for run-time
		library searches.  A reasonable value for such systems would
		be `-R$(libdir)'.

SHLIB_LIBS	Any additional libraries that shared libraries should be
		linked against when they are created.

SHLIB_LIBPREF	The prefix to use when generating the filename of the shared
		library.  The default is `lib'; Cygwin uses `cyg'.

SHLIB_LIBSUFF	The suffix to add to `libreadline' and `libhistory' when
		generating the filename of the shared library.  Many systems
		use `so'; HP-UX uses `sl'.

SHLIB_LIBVERSION The string to append to the filename to indicate the version
		of the shared library.  It should begin with $(SHLIB_LIBSUFF),
		and possibly include version information that allows the
		run-time loader to load the version of the shared library
		appropriate for a particular program.  Systems using shared
		libraries similar to SunOS 4.x use major and minor library
		version numbers; for those systems a value of
		`$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' is appropriate.
		Systems based on System V Release 4 don't use minor version
		numbers; use `$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' on those systems.
		Other Unix versions use different schemes.

SHLIB_DLLVERSION The version number for shared libraries that determines API
		compatibility between readline versions and the underlying
		system.  Used only on Cygwin.  Defaults to $SHLIB_MAJOR, but
		can be overridden at configuration time by defining DLLVERSION
		in the environment.

SHLIB_DOT	The character used to separate the name of the shared library
		from the suffix and version information.  The default is `.';
		systems like Cygwin which don't separate version information
		from the library name should set this to the empty string.

SHLIB_STATUS	Set this to `supported' when you have defined the other
		necessary variables.  Make uses this to determine whether
		or not shared library creation should be attempted.

You should look at the existing stanzas in support/shobj-conf for ideas.

Once you have updated support/shobj-conf, re-run configure and type
`make shared'.  The shared libraries will be created in the shlib
subdirectory.

If shared libraries are created, `make install' will install them. 
You may install only the shared libraries by running `make
install-shared' from the top-level build directory.  Running `make
install' in the shlib subdirectory will also work.  If you don't want
to install any created shared libraries, run `make install-static'. 

Documentation
=============

The documentation for the Readline and History libraries appears in
the `doc' subdirectory.  There are three texinfo files and a
Unix-style manual page describing the facilities available in the
Readline library.  The texinfo files include both user and
programmer's manuals.  HTML versions of the manuals appear in the
`doc' subdirectory as well. 

Reporting Bugs
==============

Bug reports for Readline should be sent to:

        bug-readline@gnu.org

When reporting a bug, please include the following information:

        * the version number and release status of Readline (e.g., 4.2-release)
        * the machine and OS that it is running on
        * a list of the compilation flags or the contents of `config.h', if
          appropriate
        * a description of the bug
        * a recipe for recreating the bug reliably
        * a fix for the bug if you have one!

If you would like to contact the Readline maintainer directly, send mail
to bash-maintainers@gnu.org.

Since Readline is developed along with bash, the bug-bash@gnu.org mailing
list (mirrored to the Usenet newsgroup gnu.bash.bug) often contains
Readline bug reports and fixes. 

Chet Ramey
chet.ramey@case.edu