execute_cmd.c,pcomplete.c,subst.c
lib/sh/stringlist.c,lib/sh/stringvec.c
- changes and casts now that the generic list functions are prototyped
+ From Paul Eggert <eggert@cs.ucla.edu>
+
+ 3/29
+ ----
+aclocal.m4,configure.ac
+builtins/common.c,builtins/mkbuiltins.c,builtins/printf.def
+include/memalloc.h,include/stdc.h
+general.h,jobs.h
+pcomplete.c,print_cmd.c
+m4/iconv.m4
+lib/readline/bind.c,lib/readline/complete.c,lib/readline/display.c
+lib/readline/funmap.c,lib/readline/util.c,lib/readline/parens.c
+lib/readline/histlib.h
+lib/readline/readline.h,lib/readline/rldefs.h,lib/readline/rlstdc.h,lib/readline/rlprivate.h
+lib/sh/dprintf.c,lib/sh/snprintf.c,lib/sh/vprintf.c
+lib/malloc/shmalloc.h,lib/malloc/imalloc.h,lib/malloc/xmalloc.c
+lib/termcap/termcap.h
+ - stdarg: since we now assume C89 for prototypes at least, always
+ prefer stdarg to old-style varargs
+ - SH_VA_START: now use plain old va_start
+ - don't bother with extern declarations for standard C89 functions
+ From Paul Eggert <eggert@cs.ucla.edu>
+
+config-bot.h
+ - PREFER_STDARG: remove
+
+builtins/mkbuiltins.c
+execute_cmd.c,unwind_prot.c
+unwind_prot.h
+ - start on ANSI/ISO C changes for the unwind-protect framework
+ - introduce new unwind-protect function pointer type to replace
+ Function
From Paul Eggert <eggert@cs.ucla.edu>
AC_CACHE_VAL(bash_cv_printf_declared,
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
-#ifdef __STDC__
typedef int (*_bashfunc)(const char *, ...);
-#else
-typedef int (*_bashfunc)();
-#endif
#include <stdlib.h>
int
main()
# We should check for putenv before calling this
AC_DEFUN(BASH_FUNC_STD_PUTENV,
[
-AC_REQUIRE([AC_C_PROTOTYPES])
AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_STDLIB_H
# We should check for unsetenv before calling this
AC_DEFUN(BASH_FUNC_STD_UNSETENV,
[
-AC_REQUIRE([AC_C_PROTOTYPES])
AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_STDLIB_H
if test X$ac_cv_func_vsnprintf = Xyes; then
AC_CACHE_CHECK([for standard-conformant vsnprintf], [bash_cv_func_vsnprintf],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#if HAVE_STDARG_H
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
static int
-#if HAVE_STDARG_H
foo(const char *fmt, ...)
-#else
-foo(format, va_alist)
- const char *format;
- va_dcl
-#endif
{
va_list args;
int n;
-#if HAVE_STDARG_H
va_start(args, fmt);
-#else
- va_start(args);
-#endif
n = vsnprintf(0, 0, fmt, args);
va_end (args);
return n;
#include <signal.h>
#include <errno.h>
-
-#if defined (PREFER_STDARG)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
+#include <stdarg.h>
#include "../bashansi.h"
#include "../bashintl.h"
}
void
-#if defined (PREFER_STDARG)
builtin_error (const char *format, ...)
-#else
-builtin_error (format, va_alist)
- const char *format;
- va_dcl
-#endif
{
va_list args;
builtin_error_prolog ();
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
va_end (args);
}
void
-#if defined (PREFER_STDARG)
builtin_warning (const char *format, ...)
-#else
-builtin_warning (format, va_alist)
- const char *format;
- va_dcl
-#endif
{
va_list args;
builtin_error_prolog ();
fprintf (stderr, _("warning: "));
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
va_end (args);
/* mkbuiltins.c - Create builtins.c, builtext.h, and builtdoc.c from
a single source file called builtins.def. */
-/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int errno;
#endif
-static char *xmalloc (size_t), *xrealloc (void *, size_t);
-
-#if !defined (__STDC__) && !defined (strcpy)
-extern char *strcpy ();
-#endif /* !__STDC__ && !strcpy */
+static void *xmalloc (size_t);
+static void *xrealloc (void *, size_t);
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
/* **************************************************************** */
/* The definition of a function. */
-typedef int Function ();
typedef int mk_handler_func_t (char *, DEF_FILE *, char *);
/* Structure handles processor directives. */
static void memory_error_and_abort (void);
-static char *
+static void *
xmalloc (size_t bytes)
{
- char *temp = (char *)malloc (bytes);
+ void *temp = malloc (bytes);
if (!temp)
memory_error_and_abort ();
return (temp);
}
-static char *
+static void *
xrealloc (void *pointer, size_t bytes)
{
- char *temp;
+ void *temp;
if (!pointer)
- temp = (char *)malloc (bytes);
+ temp = malloc (bytes);
else
- temp = (char *)realloc (pointer, bytes);
+ temp = realloc (pointer, bytes);
if (!temp)
memory_error_and_abort ();
# define INT_MIN (-2147483647-1)
#endif
-#if defined (PREFER_STDARG)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
+#include <stdarg.h>
#include <stdio.h>
#include <chartypes.h>
size_t nlen;
int blen;
- SH_VA_START (args, format);
+ va_start (args, format);
blen = vsnprintf (vbuf + vblen, vbsize - vblen, format, args);
va_end (args);
{
vbsize = ((nlen + 63) >> 6) << 6;
vbuf = (char *)xrealloc (vbuf, vbsize);
- SH_VA_START (args, format);
+ va_start (args, format);
blen = vsnprintf (vbuf + vblen, vbsize - vblen, format, args);
va_end (args);
}
# define HAVE_BSD_PGRP
#endif
-/* Try this without testing __STDC__ for the time being. */
-#if defined (HAVE_STDARG_H)
-# define PREFER_STDARG
-# define USE_VARARGS
-#else
-# if defined (HAVE_VARARGS_H)
-# define PREFER_VARARGS
-# define USE_VARARGS
-# endif
-#endif
-
#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && defined (HAVE_NETINET_IN_H)
# define HAVE_NETWORK
#endif
#! /bin/sh
-# From configure.ac for Bash 5.2, version 5.048.
+# From configure.ac for Bash 5.2, version 5.049.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for bash 5.2-maint.
#
fi
-if test "$ac_prog_cc_stdc" != no; then
-
-printf "%s\n" "#define PROTOTYPES 1" >>confdefs.h
-
-
-printf "%s\n" "#define __PROTOTYPES 1" >>confdefs.h
-
-fi
-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
printf %s "checking whether char is unsigned... " >&6; }
if test ${ac_cv_c_char_unsigned+y}
#ifdef __cplusplus
"C"
#endif
-#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
int
main (void)
then :
printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h
-fi
-ac_fn_c_check_header_compile "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdarg_h" = xyes
-then :
- printf "%s\n" "#define HAVE_STDARG_H 1" >>confdefs.h
-
fi
ac_fn_c_check_header_compile "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default"
if test "x$ac_cv_header_varargs_h" = xyes
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#if HAVE_STDARG_H
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
static int
-#if HAVE_STDARG_H
foo(const char *fmt, ...)
-#else
-foo(format, va_alist)
- const char *format;
- va_dcl
-#endif
{
va_list args;
int n;
-#if HAVE_STDARG_H
va_start(args, fmt);
-#else
- va_start(args);
-#endif
n = vsnprintf(0, 0, fmt, args);
va_end (args);
return n;
if test "$ac_cv_func_putenv" = "yes"; then
-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for standard-conformant putenv declaration" >&5
printf %s "checking for standard-conformant putenv declaration... " >&6; }
if test ${bash_cv_std_putenv+y}
fi
if test "$ac_cv_func_unsetenv" = "yes"; then
-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for standard-conformant unsetenv declaration" >&5
printf %s "checking for standard-conformant unsetenv declaration... " >&6; }
if test ${bash_cv_std_unsetenv+y}
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_REVISION([for Bash 5.2, version 5.048])dnl
+AC_REVISION([for Bash 5.2, version 5.049])dnl
define(bashvers, 5.2)
define(relstatus, maint)
AC_C_BIGENDIAN
AC_C_STRINGIZE
AC_TYPE_LONG_DOUBLE
-AC_C_PROTOTYPES
AC_C_CHAR_UNSIGNED
AC_C_VOLATILE
AC_C_RESTRICT
BASH_HEADER_INTTYPES
-AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \
+AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h limits.h string.h \
memory.h locale.h termcap.h termio.h termios.h dlfcn.h \
stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \
regex.h syslog.h ulimit.h)
# include <unistd.h>
#endif
-#if defined (PREFER_STDARG)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
-
+#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
give_terminal_to (shell_pgrp, 0);
#endif /* JOB_CONTROL */
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
error_prolog (1);
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
error_prolog (0);
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
error_prolog (1);
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
error_prolog (1);
fprintf (stderr, _("warning: "));
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
/* TRANSLATORS: this is a prefix for informational messages. */
fprintf (stderr, _("INFORM: "));
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
error_prolog (1);
fprintf (stderr, _("DEBUG warning: "));
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
e = errno;
error_prolog (0);
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, ": %s\n", strerror (e));
else
fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : _(" line "), lineno);
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fprintf(stderr, "TRACE: pid %ld: ", (long)getpid());
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");
fprintf(tracefp, "TRACE: pid %ld: ", (long)getpid());
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (tracefp, format, args);
fprintf (tracefp, "\n");
static void cleanup_redirects (REDIRECT *);
#if defined (JOB_CONTROL)
-static int restore_signal_mask (sigset_t *);
+static void restore_signal_mask (void *);
#endif
static int builtin_status (int);
#if defined (JOB_CONTROL)
/* A function to restore the signal mask to its proper value when the shell
is interrupted or errors occur while creating a pipeline. */
-static int
-restore_signal_mask (sigset_t *set)
+static void
+restore_signal_mask (void *set)
{
- return (sigprocmask (SIG_SETMASK, set, (sigset_t *)NULL));
+ sigprocmask (SIG_SETMASK, set, NULL);
}
#endif /* JOB_CONTROL */
{
nfifo = num_fifos ();
if (nfifo > ofifo)
- close_new_fifos ((void *)ofifo_list, osize);
+ close_new_fifos (ofifo_list, osize);
free (ofifo_list);
discard_unwind_frame ("internal_fifos");
}
}
static void
-maybe_restore_getopt_state (sh_getopt_state_t *gs)
+maybe_restore_getopt_state (void *arg)
{
+ sh_getopt_state_t *gs;
+
+ gs = arg;
/* If we have a local copy of OPTIND and it's at the right (current)
context, then we restore getopt's internal state. If not, we just
let it go. We know there is a local OPTIND if gs->gs_flags & 1.
#define HIGH_FD_MAX 256
/* The type of function passed as the fourth argument to qsort(3). */
-#ifdef __STDC__
typedef int QSFUNC (const void *, const void *);
-#else
-typedef int QSFUNC ();
-#endif
/* Some useful definitions for Unix pathnames. Argument convention:
x == string, c == character */
# endif /* !IBMESA */
# else /* !HAVE_ALLOCA_H || C_ALLOCA */
# if !defined (alloca)
-# if defined (__STDC__)
extern void *alloca (size_t);
-# else
-extern char *alloca ();
-# endif /* !__STDC__ */
# endif /* !alloca */
# endif /* !HAVE_ALLOCA_H || C_ALLOCA */
#endif /* !__GNUC__ || C_ALLOCA */
/* stdc.h -- macros to make source compile on both ANSI C and K&R C
compilers. */
-/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2021,2023 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
# define INLINE
#endif
-#if defined (PREFER_STDARG)
-# define SH_VA_START(va, arg) va_start(va, arg)
-#else
-# define SH_VA_START(va, arg) va_start(va)
-#endif
-
#endif /* !_STDC_H_ */
/* jobs.h -- structures and definitions used by the jobs.c file. */
-/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2023 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern void hangup_all_jobs (void);
extern void kill_current_pipeline (void);
-#if defined (__STDC__) && defined (pid_t)
+#if defined (pid_t)
extern int get_job_by_pid (int, int, PROCESS **);
extern void describe_pid (int);
#else
#define ADDRESS_FUNCTION(arg) &(arg)
#endif /* CRAY && CRAY_STACKSEG_END */
-#if __STDC__
typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
#define NULL 0
/* Generic pointer type. */
#ifndef PTR_T
-# if defined (__STDC__)
-# define PTR_T void *
-# else
-# define PTR_T char *
-# endif
+# define PTR_T void *
#endif
#if !defined (NULL)
# endif /* HAVE_BCOPY */
#endif /* !__GNUC__ */
-#if !defined (PARAMS)
-# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES)
-# define PARAMS(protos) protos
-# else
-# define PARAMS(protos) ()
-# endif
-#endif
-
/* Use Duff's device for good zeroing/copying performance. DO NOT call the
Duff's device macros with NBYTES == 0. */
assumed to not be busy; the caller (morecore()) checks for this.
BUSY[NU] must be set to 1. */
static void
-bcoalesce (register int nu)
+bcoalesce (int nu)
{
register union mhead *mp, *mp1, *mp2;
register int nbuck;
is assumed to be empty. Must be called with signals blocked (e.g.,
by morecore()). BUSY[NU] must be set to 1. */
static void
-bsplit (register int nu)
+bsplit (int nu)
{
register union mhead *mp;
int nbuck, nblks, split_max;
sigset_t set, oset;
int blocked_sigs;
- /* Block all signals in case we are executed from a signal handler. */
+ /* Block signals in case we are executed from a signal handler. */
blocked_sigs = 0;
#ifdef SHELL
# if defined (SIGCHLD)
/* Generic pointer type. */
#ifndef PTR_T
-
-#if defined (__STDC__)
# define PTR_T void *
-#else
-# define PTR_T char *
-#endif
-
#endif /* PTR_T */
-
extern PTR_T sh_malloc (size_t, const char *, int);
extern PTR_T sh_realloc (PTR_T, size_t, const char *, int);
extern void sh_free (PTR_T, const char *, int);
/* Generic pointer type. */
#ifndef PTR_T
-
-#if defined (__STDC__)
# define PTR_T void *
-#else
-# define PTR_T char *
-#endif
-
#endif /* PTR_T */
/* **************************************************************** */
#include "rlshell.h"
#include "xmalloc.h"
-#if !defined (strchr) && !defined (__STDC__)
-extern char *strchr (), *strrchr ();
-#endif /* !strchr && !__STDC__ */
-
/* Variables exported by this file. */
Keymap rl_binding_keymap;
static int _rl_skip_to_delim (char *, int, int);
-#if defined (USE_VARARGS) && defined (PREFER_STDARG)
static void _rl_init_file_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
-#else
-static void _rl_init_file_error ();
-#endif
static rl_command_func_t *_rl_function_of_keyseq_internal (const char *, size_t, Keymap, int *);
}
static void
-#if defined (PREFER_STDARG)
_rl_init_file_error (const char *format, ...)
-#else
-_rl_init_file_error (va_alist)
- va_dcl
-#endif
{
va_list args;
-#if defined (PREFER_VARARGS)
- char *format;
-#endif
-#if defined (PREFER_STDARG)
va_start (args, format);
-#else
- va_start (args);
- format = va_arg (args, char *);
-#endif
-
fprintf (stderr, "readline: ");
if (currently_reading_init_file)
fprintf (stderr, "%s: line %d: ", current_readline_init_file,
# include "colors.h"
#endif
-#ifdef __STDC__
typedef int QSFUNC (const void *, const void *);
-#else
-typedef int QSFUNC ();
-#endif
#ifdef HAVE_LSTAT
# define LSTAT lstat
/* display.c -- readline redisplay facility. */
-/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
#include "rlprivate.h"
#include "xmalloc.h"
-#if !defined (strchr) && !defined (__STDC__)
-extern char *strchr (), *strrchr ();
-#endif /* !strchr && !__STDC__ */
-
static void putc_face (int, int, char *);
static void puts_face (const char *, const char *, int);
static void norm_face (char *, int);
mini-modeline. */
static int msg_saved_prompt = 0;
-#if defined (USE_VARARGS)
int
-#if defined (PREFER_STDARG)
rl_message (const char *format, ...)
-#else
-rl_message (va_alist)
- va_dcl
-#endif
{
va_list args;
-#if defined (PREFER_VARARGS)
- char *format;
-#endif
#if defined (HAVE_VSNPRINTF)
int bneed;
#endif
-#if defined (PREFER_STDARG)
va_start (args, format);
-#else
- va_start (args);
- format = va_arg (args, char *);
-#endif
if (msg_buf == 0)
msg_buf = xmalloc (msg_bufsiz = 128);
msg_buf = xrealloc (msg_buf, msg_bufsiz);
va_end (args);
-#if defined (PREFER_STDARG)
va_start (args, format);
-#else
- va_start (args);
- format = va_arg (args, char *);
-#endif
vsnprintf (msg_buf, msg_bufsiz - 1, format, args);
}
#else
return 0;
}
-#else /* !USE_VARARGS */
-int
-rl_message (format, arg1, arg2)
- char *format;
-{
- if (msg_buf == 0)
- msg_buf = xmalloc (msg_bufsiz = 128);
-
- sprintf (msg_buf, format, arg1, arg2);
- msg_buf[msg_bufsiz - 1] = '\0'; /* overflow? */
-
- rl_display_prompt = msg_buf;
- if (saved_local_prompt == 0)
- {
- rl_save_prompt ();
- msg_saved_prompt = 1;
- }
- else if (local_prompt != saved_local_prompt)
- {
- FREE (local_prompt);
- FREE (local_prompt_prefix);
- local_prompt = (char *)NULL;
- }
- local_prompt = expand_prompt (msg_buf, 0, &prompt_visible_length,
- &prompt_last_invisible,
- &prompt_invis_chars_first_line,
- &prompt_physical_chars);
- local_prompt_prefix = (char *)NULL;
- local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
- (*rl_redisplay_function) ();
-
- return 0;
-}
-#endif /* !USE_VARARGS */
/* How to clear things from the "echo-area". */
int
* usage: rl [-p prompt] [-u unit] [-d default] [-n nchars]
*/
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library for
reading lines of text with interactive input and history editing.
extern int optind;
extern char *optarg;
-#if !defined (strchr) && !defined (__STDC__)
-extern char *strrchr();
-#endif
-
static char *progname;
static char *deftext;
#include "xmalloc.h"
-#ifdef __STDC__
typedef int QSFUNC (const void *, const void *);
-#else
-typedef int QSFUNC ();
-#endif
extern int _rl_qsort_string_compare (char **, char **);
#endif
#ifndef member
-# if !defined (strchr) && !defined (__STDC__)
-extern char *strchr ();
-# endif /* !strchr && !__STDC__ */
#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
#endif
# include <strings.h>
#endif /* !HAVE_STRING_H */
-#if !defined (strchr) && !defined (__STDC__)
-extern char *strchr (), *strrchr ();
-#endif /* !strchr && !__STDC__ */
-
#include "readline.h"
#include "rlprivate.h"
/* Readline.h -- the names of functions callable from within readline. */
-/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
extern void rl_deactivate_mark (void);
extern int rl_mark_active_p (void);
-#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
-#else
-extern int rl_message ();
-#endif
extern int rl_show_char (int);
# include <strings.h>
#endif /* !HAVE_STRING_H */
-#if !defined (strchr) && !defined (__STDC__)
-extern char *strchr (), *strrchr ();
-#endif /* !strchr && !__STDC__ */
-
-#if defined (PREFER_STDARG)
-# include <stdarg.h>
-#else
-# if defined (PREFER_VARARGS)
-# include <varargs.h>
-# endif
-#endif
+#include <stdarg.h>
#if defined (HAVE_STRCASECMP)
#define _rl_stricmp strcasecmp
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
-/* Copyright (C) 1999-2022 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
extern void _rl_free_undo_list (UNDO_LIST *);
/* util.c */
-#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern void _rl_ttymsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_errmsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
extern void _rl_trace (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
-#else
-extern void _rl_ttymsg ();
-extern void _rl_errmsg ();
-extern void _rl_trace ();
-#endif
extern void _rl_audit_tty (char *);
extern int _rl_tropen (void);
/* stdc.h -- macros to make source compile on both ANSI C and K&R C compilers. */
-/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2009,2023 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
# endif
#endif
-/* Moved from config.h.in because readline.h:rl_message depends on these
- defines. */
-#if defined (__STDC__) && defined (HAVE_STDARG_H)
-# define PREFER_STDARG
-# define USE_VARARGS
-#else
-# if defined (HAVE_VARARGS_H)
-# define PREFER_VARARGS
-# define USE_VARARGS
-# endif
-#endif
-
#endif /* !_RL_STDC_H_ */
return (0);
}
-#if defined (USE_VARARGS)
void
-#if defined (PREFER_STDARG)
_rl_ttymsg (const char *format, ...)
-#else
-_rl_ttymsg (va_alist)
- va_dcl
-#endif
{
va_list args;
-#if defined (PREFER_VARARGS)
- char *format;
-#endif
-#if defined (PREFER_STDARG)
va_start (args, format);
-#else
- va_start (args);
- format = va_arg (args, char *);
-#endif
fprintf (stderr, "readline: ");
vfprintf (stderr, format, args);
}
void
-#if defined (PREFER_STDARG)
_rl_errmsg (const char *format, ...)
-#else
-_rl_errmsg (va_alist)
- va_dcl
-#endif
{
va_list args;
-#if defined (PREFER_VARARGS)
- char *format;
-#endif
-#if defined (PREFER_STDARG)
va_start (args, format);
-#else
- va_start (args);
- format = va_arg (args, char *);
-#endif
fprintf (stderr, "readline: ");
vfprintf (stderr, format, args);
va_end (args);
}
-#else /* !USE_VARARGS */
-void
-_rl_ttymsg (format, arg1, arg2)
- char *format;
-{
- fprintf (stderr, "readline: ");
- fprintf (stderr, format, arg1, arg2);
- fprintf (stderr, "\n");
-
- rl_forced_update_display ();
-}
-
-void
-_rl_errmsg (format, arg1, arg2)
- char *format;
-{
- fprintf (stderr, "readline: ");
- fprintf (stderr, format, arg1, arg2);
- fprintf (stderr, "\n");
-}
-#endif /* !USE_VARARGS */
-
/* **************************************************************** */
/* */
/* String Utility Functions */
}
#if defined (DEBUG)
-#if defined (USE_VARARGS)
static FILE *_rl_tracefp;
void
-#if defined (PREFER_STDARG)
_rl_trace (const char *format, ...)
-#else
-_rl_trace (va_alist)
- va_dcl
-#endif
{
va_list args;
-#if defined (PREFER_VARARGS)
- char *format;
-#endif
-#if defined (PREFER_STDARG)
va_start (args, format);
-#else
- va_start (args);
- format = va_arg (args, char *);
-#endif
if (_rl_tracefp == 0)
_rl_tropen ();
{
_rl_tracefp = fp;
}
-#endif
#endif /* DEBUG */
/* dprintf -- printf to a file descriptor */
-/* Copyright (C) 2008-2010,2022 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2010,2022,2023 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
# include <unistd.h>
#endif
-#if defined (PREFER_STDARG)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
-
+#include <stdarg.h>
#include <stdio.h>
int
return -1;
}
- SH_VA_START (args, format);
+ va_start (args, format);
rc = vfprintf (fp, format, args);
fflush (fp);
va_end (args);
+++ /dev/null
-/* fdprintf -- printf to a file descriptor */
-
-/* Copyright (C) 2008,2009 Free Software Foundation, Inc.
-
- This file is part of GNU Bash, the Bourne Again SHell.
-
- Bash is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Bash 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 Bash. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdc.h>
-
-#if defined (HAVE_UNISTD_H)
-# include <unistd.h>
-#endif
-
-#if defined (PREFER_STDARG)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
-
-#include <stdio.h>
-
-int
-#if defined (PREFER_STDARG)
-fdprintf(int fd, const char *format, ...)
-#else
-fdprintf(fd, format, va_alist)
- int fd;
- const char *format;
- va_dcl
-#endif
-{
- FILE *fp;
- int fd2, rc, r2;
- va_list args;
-
- if ((fd2 = dup(fd)) < 0)
- return -1;
- fp = fdopen (fd2, "w");
- if (fp == 0)
- {
- close (fd2);
- return -1;
- }
-
- SH_VA_START (args, format);
- rc = vfprintf (fp, format, args);
- fflush (fp);
- va_end (args);
-
- r2 = fclose (fp); /* check here */
-
- return rc;
-}
#endif
#define HAVE_ISINF_IN_LIBC
#define HAVE_ISNAN_IN_LIBC
-#define PREFER_STDARG
#define HAVE_STRINGIZE
#define HAVE_LIMITS_H
#define HAVE_STDDEF_H
#include <bashtypes.h>
-#if defined(PREFER_STDARG)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
+#include <stdarg.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
int rval;
va_list args;
- SH_VA_START(args, format);
+ va_start(args, format);
if (string == 0 && length != 0)
return 0;
int rval;
va_list args;
- SH_VA_START(args, format);
+ va_start(args, format);
rval = vasprintf (stringp, format, args);
#include <stdio.h>
#if !defined (NULL)
-# if defined (__STDC__)
-# define NULL ((void *)0)
-# else
-# define NULL 0x0
-# endif /* __STDC__ */
+# define NULL 0
#endif /* !NULL */
/*
/* termcap.h - public declarations for termcap library. */
-/* Copyright (C) 1991, 1992, 1995, 2001, 2005, 2006, 2008,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2009,2023 Free Software Foundation, Inc.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifndef _TERMCAP_H
#define _TERMCAP_H 1
-#if __STDC__
-
extern int tgetent (char *buffer, const char *termtype);
extern int tgetnum (const char *name);
extern char *tgoto (const char *cstring, int hpos, int vpos);
-#else /* not __STDC__ */
-
-extern int tgetent ();
-
-extern int tgetnum ();
-extern int tgetflag ();
-extern char *tgetstr ();
-
-extern char PC;
-extern short ospeed;
-
-extern void tputs ();
-
-extern char *tparam ();
-
-extern char *UP;
-extern char *BC;
-
-extern char *tgoto ();
-
-#endif /* not __STDC__ */
-
#endif /* not _TERMCAP_H */
#ifdef __cplusplus
"C"
#endif
-#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
]],
[[]])],
[am_cv_proto_iconv_arg1=""],
#include <signal.h>
-#if defined (PREFER_STDARG)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
+#include <stdarg.h>
#include "posixtime.h"
if (progcomp_debug == 0)
return;
- SH_VA_START (args, format);
+ va_start (args, format);
fprintf (stdout, "DEBUG: ");
vfprintf (stdout, format, args);
# include <unistd.h>
#endif
-#if defined (PREFER_STDARG)
-# include <stdarg.h>
-#else
-# include <varargs.h>
-#endif
+#include <stdarg.h>
#include "bashansi.h"
#include "bashintl.h"
size_t arg_len;
va_list args;
- SH_VA_START (args, control);
+ va_start (args, control);
arg_len = strlen (control);
the_printed_command_resize (arg_len + 1);
}
}
-#if defined (HAVE_VPRINTF)
-/* ``If vprintf is available, you may assume that vfprintf and vsprintf are
- also available.'' */
-
static void
xprintf (const char *format, ...)
{
va_list args;
- SH_VA_START (args, format);
+ va_start (args, format);
vfprintf (stdout, format, args);
va_end (args);
}
-
-#else
-
-static void
-xprintf (format, arg1, arg2, arg3, arg4, arg5)
- const char *format;
-{
- printf (format, arg1, arg2, arg3, arg4, arg5);
-}
-
-#endif /* !HAVE_VPRINTF */
/* I can't stand it anymore! Please can't we just write the
whole Unix system in lisp or something? */
-/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2023 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
} sv;
} UNWIND_ELT;
-static void without_interrupts (VFunction *, char *, char *);
-static void unwind_frame_discard_internal (char *, char *);
-static void unwind_frame_run_internal (char *, char *);
+static void unwind_frame_discard_internal (char *);
+static void unwind_frame_run_internal (char *);
static void add_unwind_protect_internal (Function *, char *);
-static void remove_unwind_protect_internal (char *, char *);
-static void run_unwind_protects_internal (char *, char *);
-static void clear_unwind_protects_internal (char *, char *);
+static void remove_unwind_protect_internal (void);
+static void run_unwind_protects_internal (void);
+static void clear_unwind_protects_internal (int);
static inline void restore_variable (SAVED_VAR *);
static void unwind_protect_mem_internal (char *, char *);
ocache_create (uwcache, UNWIND_ELT, UWCACHESIZE);
}
-/* Run a function without interrupts. This relies on the fact that the
- FUNCTION cannot call QUIT (). */
-static void
-without_interrupts (VFunction *function, char *arg1, char *arg2)
-{
- (*function)(arg1, arg2);
-}
-
/* Start the beginning of a region. */
void
begin_unwind_frame (char *tag)
{
- add_unwind_protect ((Function *)NULL, tag);
+ add_unwind_protect (NULL, tag);
}
/* Discard the unwind protects back to TAG. */
discard_unwind_frame (char *tag)
{
if (unwind_protect_list)
- without_interrupts (unwind_frame_discard_internal, tag, (char *)NULL);
+ unwind_frame_discard_internal (tag);
}
/* Run the unwind protects back to TAG. */
run_unwind_frame (char *tag)
{
if (unwind_protect_list)
- without_interrupts (unwind_frame_run_internal, tag, (char *)NULL);
+ unwind_frame_run_internal (tag);
}
/* Add the function CLEANUP with ARG to the list of unwindable things. */
void
add_unwind_protect (Function *cleanup, char *arg)
{
- without_interrupts (add_unwind_protect_internal, (char *)cleanup, arg);
+ add_unwind_protect_internal (cleanup, arg);
}
/* Remove the top unwind protect from the list. */
remove_unwind_protect (void)
{
if (unwind_protect_list)
- without_interrupts
- (remove_unwind_protect_internal, (char *)NULL, (char *)NULL);
+ remove_unwind_protect_internal ();
}
/* Run the list of cleanup functions in unwind_protect_list. */
run_unwind_protects (void)
{
if (unwind_protect_list)
- without_interrupts
- (run_unwind_protects_internal, (char *)NULL, (char *)NULL);
+ run_unwind_protects_internal ();
}
/* Erase the unwind-protect list. If flags is 1, free the elements. */
void
clear_unwind_protect_list (int flags)
{
- char *flag;
-
if (unwind_protect_list)
- {
- flag = flags ? "" : (char *)NULL;
- without_interrupts
- (clear_unwind_protects_internal, flag, (char *)NULL);
- }
+ clear_unwind_protects_internal (flags);
}
int
}
static void
-remove_unwind_protect_internal (char *ignore1, char *ignore2)
+remove_unwind_protect_internal (void)
{
UNWIND_ELT *elt;
}
static void
-run_unwind_protects_internal (char *ignore1, char *ignore2)
+run_unwind_protects_internal (void)
{
- unwind_frame_run_internal ((char *) NULL, (char *) NULL);
+ unwind_frame_run_internal (NULL);
}
static void
-clear_unwind_protects_internal (char *flag, char *ignore)
+clear_unwind_protects_internal (int flag)
{
if (flag)
{
while (unwind_protect_list)
- remove_unwind_protect_internal ((char *)NULL, (char *)NULL);
+ remove_unwind_protect_internal ();
}
unwind_protect_list = (UNWIND_ELT *)NULL;
}
static void
-unwind_frame_discard_internal (char *tag, char *ignore)
+unwind_frame_discard_internal (char *tag)
{
UNWIND_ELT *elt;
int found;
}
static void
-unwind_frame_run_internal (char *tag, char *ignore)
+unwind_frame_run_internal (char *tag)
{
UNWIND_ELT *elt;
int found;
void
unwind_protect_mem (char *var, int size)
{
- without_interrupts (unwind_protect_mem_internal, var, (char *) &size);
+ unwind_protect_mem_internal (var, (char *) &size);
}
#if defined (DEBUG)
/* unwind_prot.h - Macros and functions for hacking unwind protection. */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2023 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#if !defined (_UNWIND_PROT_H)
#define _UNWIND_PROT_H
+/* Generic function type void (*) (void *) for all unwind cleanups. A
+ cleanup function does not return a value and takes a single generic
+ pointer argument. This type works fine for arbitrary pointers; if a
+ cleanup function needs to take an int argument, it's passed through
+ a cast to intptr_t, an integer type that's safe to convert to and
+ from a pointer. */
+typedef void sh_uwfunc_t (void *);
+
extern void uwp_init (void);
/* Run a function without interrupts. */
/* How to protect a variable. */
#define unwind_protect_var(X) unwind_protect_mem ((char *)&(X), sizeof (X))
+
extern void unwind_protect_mem (char *, int);
/* Backwards compatibility */