summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2023-01-03 10:01:11 -0500
committerChet Ramey <chet.ramey@case.edu>2023-01-03 10:01:11 -0500
commit81e3a4fb07d78880a737c15624d38f84ad68313b (patch)
treebd2e317c68dd74db25e5ac64f47c0f096d7087ca /lib
parentb648a9ab7978f5356bba92d17abe15142e6eb157 (diff)
downloadbash-81e3a4fb07d78880a737c15624d38f84ad68313b.tar.gz
first set of ANSI C changes: remove PARAMS
Diffstat (limited to 'lib')
-rw-r--r--lib/glob/glob.c96
-rw-r--r--lib/glob/glob.h10
-rw-r--r--lib/glob/glob_loop.c7
-rw-r--r--lib/glob/gmisc.c8
-rw-r--r--lib/glob/sm_loop.c50
-rw-r--r--lib/glob/smatch.c66
-rw-r--r--lib/glob/strmatch.c16
-rw-r--r--lib/glob/strmatch.h6
-rw-r--r--lib/glob/xmbsrtowcs.c31
-rw-r--r--lib/intl/bindtextdom.c6
-rw-r--r--lib/intl/dcigettext.c38
-rw-r--r--lib/intl/eval-plural.h14
-rw-r--r--lib/intl/finddomain.c5
-rw-r--r--lib/intl/gettextP.h64
-rw-r--r--lib/intl/hash-string.h13
-rw-r--r--lib/intl/l10nflist.c14
-rw-r--r--lib/intl/loadinfo.h18
-rw-r--r--lib/intl/loadmsgcat.c18
-rw-r--r--lib/intl/localealias.c25
-rw-r--r--lib/intl/plural-exp.c5
-rw-r--r--lib/intl/plural-exp.h23
-rw-r--r--lib/intl/plural.c27
-rw-r--r--lib/intl/plural.y27
-rw-r--r--lib/malloc/alloca.c7
-rw-r--r--lib/malloc/imalloc.h6
-rw-r--r--lib/malloc/malloc.c186
-rw-r--r--lib/malloc/mstats.h10
-rw-r--r--lib/malloc/shmalloc.h39
-rw-r--r--lib/malloc/stats.c32
-rw-r--r--lib/malloc/table.c66
-rw-r--r--lib/malloc/table.h20
-rw-r--r--lib/malloc/trace.c30
-rw-r--r--lib/malloc/watch.c20
-rw-r--r--lib/malloc/watch.h6
-rw-r--r--lib/malloc/xmalloc.c15
-rw-r--r--lib/readline/tcap.h12
-rw-r--r--lib/sh/casemod.c13
-rw-r--r--lib/sh/clktck.c4
-rw-r--r--lib/sh/clock.c20
-rw-r--r--lib/sh/dprintf.c9
-rw-r--r--lib/sh/eaccess.c27
-rw-r--r--lib/sh/fmtulong.c7
-rw-r--r--lib/sh/fnxform.c32
-rw-r--r--lib/sh/fpurge.c4
-rw-r--r--lib/sh/getcwd.c14
-rw-r--r--lib/sh/getenv.c50
-rw-r--r--lib/sh/gettimeofday.c2
-rw-r--r--lib/sh/inet_aton.c7
-rw-r--r--lib/sh/input_avail.c7
-rw-r--r--lib/sh/itos.c19
-rw-r--r--lib/sh/mailstat.c6
-rw-r--r--lib/sh/makepath.c8
-rw-r--r--lib/sh/mbscasecmp.c4
-rw-r--r--lib/sh/mbschr.c6
-rw-r--r--lib/sh/mbscmp.c4
-rw-r--r--lib/sh/mktime.c157
-rw-r--r--lib/sh/netconn.c5
-rw-r--r--lib/sh/netopen.c47
-rw-r--r--lib/sh/oslib.c43
-rw-r--r--lib/sh/pathcanon.c14
-rw-r--r--lib/sh/pathphys.c19
-rw-r--r--lib/sh/random.c42
-rw-r--r--lib/sh/rename.c5
-rw-r--r--lib/sh/setlinebuf.c3
-rw-r--r--lib/sh/shmatch.c5
-rw-r--r--lib/sh/shmbchar.c13
-rw-r--r--lib/sh/shquote.c38
-rw-r--r--lib/sh/shtty.c62
-rw-r--r--lib/sh/snprintf.c174
-rw-r--r--lib/sh/spell.c21
-rw-r--r--lib/sh/strcasecmp.c11
-rw-r--r--lib/sh/strcasestr.c6
-rw-r--r--lib/sh/strchrnul.c6
-rw-r--r--lib/sh/strdup.c5
-rw-r--r--lib/sh/strerror.c5
-rw-r--r--lib/sh/stringlist.c51
-rw-r--r--lib/sh/stringvec.c52
-rw-r--r--lib/sh/strnlen.c6
-rw-r--r--lib/sh/strpbrk.c6
-rw-r--r--lib/sh/strstr.c2
-rw-r--r--lib/sh/strtod.c8
-rw-r--r--lib/sh/strtoimax.c11
-rw-r--r--lib/sh/strtol.c7
-rw-r--r--lib/sh/strtoumax.c11
-rw-r--r--lib/sh/strtrans.c20
-rw-r--r--lib/sh/strvis.c10
-rw-r--r--lib/sh/times.c7
-rw-r--r--lib/sh/timeval.c30
-rw-r--r--lib/sh/tmpfile.c31
-rw-r--r--lib/sh/uconvert.c7
-rw-r--r--lib/sh/ufuncs.c12
-rw-r--r--lib/sh/unicode.c32
-rw-r--r--lib/sh/utf8.c24
-rw-r--r--lib/sh/vprint.c9
-rw-r--r--lib/sh/wcsdup.c5
-rw-r--r--lib/sh/wcsnwidth.c6
-rw-r--r--lib/sh/wcswidth.c6
-rw-r--r--lib/sh/winsize.c16
-rw-r--r--lib/sh/zcatfd.c10
-rw-r--r--lib/sh/zgetline.c21
-rw-r--r--lib/sh/zmapfd.c9
-rw-r--r--lib/sh/zread.c35
-rw-r--r--lib/sh/zwrite.c7
103 files changed, 757 insertions, 1654 deletions
diff --git a/lib/glob/glob.c b/lib/glob/glob.c
index 686d0f6b..eaca7783 100644
--- a/lib/glob/glob.c
+++ b/lib/glob/glob.c
@@ -1,6 +1,6 @@
/* glob.c -- file-name wildcard pattern matching for Bash.
- Copyright (C) 1985-2021 Free Software Foundation, Inc.
+ Copyright (C) 1985-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -84,11 +84,11 @@ struct globval
char *name;
};
-extern void throw_to_top_level PARAMS((void));
-extern int sh_eaccess PARAMS((const char *, int));
-extern char *sh_makepath PARAMS((const char *, const char *, int));
-extern int signal_is_pending PARAMS((int));
-extern void run_pending_traps PARAMS((void));
+extern void throw_to_top_level (void);
+extern int sh_eaccess (const char *, int);
+extern char *sh_makepath (const char *, const char *, int);
+extern int signal_is_pending (int);
+extern void run_pending_traps (void);
extern int extended_glob;
@@ -111,29 +111,29 @@ char *glob_error_return;
static struct globval finddirs_error_return;
/* Some forward declarations. */
-static int skipname PARAMS((char *, char *, int));
+static int skipname (char *, char *, int);
#if HANDLE_MULTIBYTE
-static int mbskipname PARAMS((char *, char *, int));
+static int mbskipname (char *, char *, int);
#endif
-void udequote_pathname PARAMS((char *));
+void udequote_pathname (char *);
#if HANDLE_MULTIBYTE
-void wcdequote_pathname PARAMS((wchar_t *));
-static void wdequote_pathname PARAMS((char *));
-static void dequote_pathname PARAMS((char *));
+void wcdequote_pathname (wchar_t *);
+static void wdequote_pathname (char *);
+static void dequote_pathname (char *);
#else
# define dequote_pathname(p) udequote_pathname(p)
#endif
-static int glob_testdir PARAMS((char *, int));
-static char **glob_dir_to_array PARAMS((char *, char **, int));
+static int glob_testdir (char *, int);
+static char **glob_dir_to_array (char *, char **, int);
/* Make sure these names continue to agree with what's in smatch.c */
-extern char *glob_patscan PARAMS((char *, char *, int, int));
-extern wchar_t *glob_patscan_wc PARAMS((wchar_t *, wchar_t *, wint_t, int));
+extern char *glob_patscan (char *, char *, int, int);
+extern wchar_t *glob_patscan_wc (wchar_t *, wchar_t *, wint_t, int);
/* And this from gmisc.c/gm_loop.c */
-extern int wextglob_pattern_p PARAMS((wchar_t *));
+extern int wextglob_pattern_p (wchar_t *);
-extern char *glob_dirscan PARAMS((char *, int));
+extern char *glob_dirscan (char *, int);
/* Compile `glob_loop.c' for single-byte characters. */
#define GCHAR unsigned char
@@ -158,8 +158,7 @@ extern char *glob_dirscan PARAMS((char *, int));
/* And now a function that calls either the single-byte or multibyte version
of internal_glob_pattern_p. */
int
-glob_pattern_p (pattern)
- const char *pattern;
+glob_pattern_p (const char *pattern)
{
#if HANDLE_MULTIBYTE
size_t n;
@@ -196,9 +195,7 @@ glob_pattern_p (pattern)
that the name should be skipped. XXX - doesn't handle pattern negation,
not sure if it should */
static int
-extglob_skipname (pat, dname, flags)
- char *pat, *dname;
- int flags;
+extglob_skipname (char *pat, char *dname, int flags)
{
char *pp, *pe, *t, *se;
int n, r, negate, wild, nullpat, xflags;
@@ -267,10 +264,7 @@ extglob_skipname (pat, dname, flags)
/* Return 1 if DNAME should be skipped according to PAT. Mostly concerned
with matching leading `.'. */
static int
-skipname (pat, dname, flags)
- char *pat;
- char *dname;
- int flags;
+skipname (char *pat, char *dname, int flags)
{
int i;
@@ -310,9 +304,7 @@ skipname (pat, dname, flags)
#if HANDLE_MULTIBYTE
static int
-wskipname (pat, dname, flags)
- wchar_t *pat, *dname;
- int flags;
+wskipname (wchar_t *pat, wchar_t *dname, int flags)
{
int i;
@@ -346,9 +338,7 @@ wskipname (pat, dname, flags)
}
static int
-wextglob_skipname (pat, dname, flags)
- wchar_t *pat, *dname;
- int flags;
+wextglob_skipname (wchar_t *pat, wchar_t *dname, int flags)
{
#if EXTENDED_GLOB
wchar_t *pp, *pe, *t, *se, n;
@@ -415,9 +405,7 @@ wextglob_skipname (pat, dname, flags)
/* Return 1 if DNAME should be skipped according to PAT. Handles multibyte
characters in PAT and DNAME. Mostly concerned with matching leading `.'. */
static int
-mbskipname (pat, dname, flags)
- char *pat, *dname;
- int flags;
+mbskipname (char *pat, char *dname, int flags)
{
int ret, ext;
wchar_t *pat_wc, *dn_wc;
@@ -452,8 +440,7 @@ mbskipname (pat, dname, flags)
/* Remove backslashes quoting characters in PATHNAME by modifying PATHNAME. */
void
-udequote_pathname (pathname)
- char *pathname;
+udequote_pathname (char *pathname)
{
register int i, j;
@@ -474,8 +461,7 @@ udequote_pathname (pathname)
#if HANDLE_MULTIBYTE
/* Remove backslashes quoting characters in PATHNAME by modifying PATHNAME. */
void
-wcdequote_pathname (wpathname)
- wchar_t *wpathname;
+wcdequote_pathname (wchar_t *wpathname)
{
int i, j;
@@ -494,8 +480,7 @@ wcdequote_pathname (wpathname)
}
static void
-wdequote_pathname (pathname)
- char *pathname;
+wdequote_pathname (char *pathname)
{
mbstate_t ps;
size_t len, n;
@@ -538,8 +523,7 @@ wdequote_pathname (pathname)
}
static void
-dequote_pathname (pathname)
- char *pathname;
+dequote_pathname (char *pathname)
{
if (MB_CUR_MAX > 1)
wdequote_pathname (pathname);
@@ -562,9 +546,7 @@ dequote_pathname (pathname)
/* Return 0 if DIR is a directory, -2 if DIR is a symlink, -1 otherwise. */
static int
-glob_testdir (dir, flags)
- char *dir;
- int flags;
+glob_testdir (char *dir, int flags)
{
struct stat finfo;
int r;
@@ -596,12 +578,7 @@ glob_testdir (dir, flags)
directories in the returned list. These two variables exist for the
convenience of the caller (always glob_vector). */
static struct globval *
-finddirs (pat, sdir, flags, ep, np)
- char *pat;
- char *sdir;
- int flags;
- struct globval **ep;
- int *np;
+finddirs (char *pat, char *sdir, int flags, struct globval **ep, int *np)
{
char **r, *n;
int ndirs;
@@ -674,10 +651,7 @@ finddirs (pat, sdir, flags, ep, np)
Look in errno for more information. */
char **
-glob_vector (pat, dir, flags)
- char *pat;
- char *dir;
- int flags;
+glob_vector (char *pat, char *dir, int flags)
{
DIR *d;
register struct dirent *dp;
@@ -1059,9 +1033,7 @@ glob_vector (pat, dir, flags)
it takes care of free()ing that array. Thus, you might think of this
function as side-effecting ARRAY. This should handle GX_MARKDIRS. */
static char **
-glob_dir_to_array (dir, array, flags)
- char *dir, **array;
- int flags;
+glob_dir_to_array (char *dir, char **array, int flags)
{
register unsigned int i, l;
int add_slash;
@@ -1148,9 +1120,7 @@ glob_dir_to_array (dir, array, flags)
If there isn't enough memory, then return NULL.
If a file system error occurs, return -1; `errno' has the error code. */
char **
-glob_filename (pathname, flags)
- char *pathname;
- int flags;
+glob_filename (char *pathname, int flags)
{
char **result, **new_result;
unsigned int result_size;
diff --git a/lib/glob/glob.h b/lib/glob/glob.h
index 47410577..f5304e84 100644
--- a/lib/glob/glob.h
+++ b/lib/glob/glob.h
@@ -1,5 +1,5 @@
/* File-name wildcard pattern matching for GNU.
- Copyright (C) 1985-2021 Free Software Foundation, Inc.
+ Copyright (C) 1985-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -34,11 +34,11 @@
#define GX_SYMLINK 0x1000 /* internal -- symlink to a directory */
#define GX_NEGATE 0x2000 /* internal -- extglob pattern being negated */
-extern int glob_pattern_p PARAMS((const char *));
-extern char **glob_vector PARAMS((char *, char *, int));
-extern char **glob_filename PARAMS((char *, int));
+extern int glob_pattern_p (const char *);
+extern char **glob_vector (char *, char *, int);
+extern char **glob_filename (char *, int);
-extern int extglob_pattern_p PARAMS((const char *));
+extern int extglob_pattern_p (const char *);
extern char *glob_error_return;
extern int noglob_dot_filenames;
diff --git a/lib/glob/glob_loop.c b/lib/glob/glob_loop.c
index 467e7ae3..e776e799 100644
--- a/lib/glob/glob_loop.c
+++ b/lib/glob/glob_loop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -16,13 +16,12 @@
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
-static int INTERNAL_GLOB_PATTERN_P PARAMS((const GCHAR *));
+static int INTERNAL_GLOB_PATTERN_P (const GCHAR *);
/* Return nonzero if PATTERN has any special globbing chars in it.
Compiled twice, once each for single-byte and multibyte characters. */
static int
-INTERNAL_GLOB_PATTERN_P (pattern)
- const GCHAR *pattern;
+INTERNAL_GLOB_PATTERN_P (const GCHAR *pattern)
{
register const GCHAR *p;
register GCHAR c;
diff --git a/lib/glob/gmisc.c b/lib/glob/gmisc.c
index 24fdf746..45ea4f4e 100644
--- a/lib/glob/gmisc.c
+++ b/lib/glob/gmisc.c
@@ -1,6 +1,6 @@
/* gmisc.c -- miscellaneous pattern matching utility functions for Bash.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -38,7 +38,7 @@
#include "glob.h"
/* Make sure these names continue to agree with what's in smatch.c */
-extern char *glob_patscan PARAMS((char *, char *, int, int));
+extern char *glob_patscan (char *, char *, int, int);
/* Compile `gm_loop.c' for single-byte characters. */
#define CHAR char
@@ -79,9 +79,7 @@ extern char *glob_patscan PARAMS((char *, char *, int, int));
is only called when extended_glob is set, so we have to skip over extglob
patterns x(...) */
char *
-glob_dirscan (pat, dirsep)
- char *pat;
- int dirsep;
+glob_dirscan (char *pat, int dirsep)
{
char *p, *d, *pe, *se;
diff --git a/lib/glob/sm_loop.c b/lib/glob/sm_loop.c
index f419b036..61591215 100644
--- a/lib/glob/sm_loop.c
+++ b/lib/glob/sm_loop.c
@@ -24,22 +24,19 @@ struct STRUCT
CHAR *string;
};
-int FCT PARAMS((CHAR *, CHAR *, int));
+int FCT (CHAR *, CHAR *, int);
-static int GMATCH PARAMS((CHAR *, CHAR *, CHAR *, CHAR *, struct STRUCT *, int));
-static inline CHAR *PARSE_SUBBRACKET PARAMS((CHAR *, int));
-static CHAR *BRACKMATCH PARAMS((CHAR *, U_CHAR, int));
-static int EXTMATCH PARAMS((INT, CHAR *, CHAR *, CHAR *, CHAR *, int));
+static int GMATCH (CHAR *, CHAR *, CHAR *, CHAR *, struct STRUCT *, int);
+static inline CHAR *PARSE_SUBBRACKET (CHAR *, int);
+static CHAR *BRACKMATCH (CHAR *, U_CHAR, int);
+static int EXTMATCH (INT, CHAR *, CHAR *, CHAR *, CHAR *, int);
-extern void DEQUOTE_PATHNAME PARAMS((CHAR *));
+extern void DEQUOTE_PATHNAME (CHAR *);
-/*static*/ CHAR *PATSCAN PARAMS((CHAR *, CHAR *, INT, int));
+/*static*/ CHAR *PATSCAN (CHAR *, CHAR *, INT, int);
int
-FCT (pattern, string, flags)
- CHAR *pattern;
- CHAR *string;
- int flags;
+FCT (CHAR *pattern, CHAR *string, int flags)
{
CHAR *se, *pe;
@@ -55,11 +52,7 @@ FCT (pattern, string, flags)
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, FNM_NOMATCH if not. */
static int
-GMATCH (string, se, pattern, pe, ends, flags)
- CHAR *string, *se;
- CHAR *pattern, *pe;
- struct STRUCT *ends;
- int flags;
+GMATCH (CHAR *string, CHAR *se, CHAR *pattern, CHAR *pe, struct STRUCT *ends, int flags)
{
CHAR *p, *n; /* pattern, string */
INT c; /* current pattern character - XXX U_CHAR? */
@@ -387,9 +380,7 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
P points to the character after the opening bracket. Returns NULL if the
symbol isn't correctly terminated. */
static inline CHAR *
-PARSE_SUBBRACKET (p, flags)
- CHAR *p;
- int flags;
+PARSE_SUBBRACKET (CHAR *p, int flags)
{
CHAR type; /* the type of special bracket expression symbol */
@@ -404,14 +395,7 @@ PARSE_SUBBRACKET (p, flags)
/* Use prototype definition here because of type promotion. */
static CHAR *
-#if defined (PROTOTYPES)
BRACKMATCH (CHAR *p, U_CHAR test, int flags)
-#else
-BRACKMATCH (p, test, flags)
- CHAR *p;
- U_CHAR test;
- int flags;
-#endif
{
register CHAR cstart, cend, c;
register int not; /* Nonzero if the sense of the character class is inverted. */
@@ -689,10 +673,7 @@ matched:
first character after the matching DELIM or NULL if the pattern is
empty or invalid. */
/*static*/ CHAR *
-PATSCAN (string, end, delim, flags)
- CHAR *string, *end;
- INT delim;
- int flags;
+PATSCAN (CHAR *string, CHAR *end, INT delim, int flags)
{
int pnest, bnest, skip;
CHAR *s, c, *bfirst, *t;
@@ -777,8 +758,7 @@ PATSCAN (string, end, delim, flags)
/* Return 0 if dequoted pattern matches S in the current locale. */
static int
-STRCOMPARE (p, pe, s, se)
- CHAR *p, *pe, *s, *se;
+STRCOMPARE (CHAR *p, CHAR *pe, CHAR *s, CHAR *se)
{
int ret;
CHAR c1, c2;
@@ -817,11 +797,7 @@ STRCOMPARE (p, pe, s, se)
the first time an extended pattern specifier is encountered, so it calls
gmatch recursively. */
static int
-EXTMATCH (xc, s, se, p, pe, flags)
- INT xc; /* select which operation */
- CHAR *s, *se;
- CHAR *p, *pe;
- int flags;
+EXTMATCH (INT xc, CHAR *s, CHAR *se, CHAR *p, CHAR *pe, int flags)
{
CHAR *prest; /* pointer to rest of pattern */
CHAR *psub; /* pointer to sub-pattern */
diff --git a/lib/glob/smatch.c b/lib/glob/smatch.c
index fd95e6cb..eb105c05 100644
--- a/lib/glob/smatch.c
+++ b/lib/glob/smatch.c
@@ -1,7 +1,7 @@
/* strmatch.c -- ksh-like extended pattern matching for the shell and filename
globbing. */
-/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -67,8 +67,7 @@ int glob_recursion_depth;
to fnmatch to see if wide characters c1 and c2 collate as members of the
same equivalence class. We can't really do this portably any other way */
static int
-_fnmatch_fallback (s, p)
- int s, p; /* string char, patchar */
+_fnmatch_fallback (int s, int p)
{
char s1[2]; /* string */
char s2[8]; /* constructed pattern */
@@ -100,9 +99,7 @@ _fnmatch_fallback (s, p)
/* Return 0 if C1 == C2 or collates equally if FORCECOLL is non-zero. */
static int
-charcmp (c1, c2, forcecoll)
- int c1, c2;
- int forcecoll;
+charcmp (int c1, int c2, int forcecoll)
{
static char s1[2] = { ' ', '\0' };
static char s2[2] = { ' ', '\0' };
@@ -125,9 +122,7 @@ charcmp (c1, c2, forcecoll)
}
static int
-rangecmp (c1, c2, forcecoll)
- int c1, c2;
- int forcecoll;
+rangecmp (int c1, int c2, int forcecoll)
{
int r;
@@ -145,8 +140,7 @@ rangecmp (c1, c2, forcecoll)
#if defined (HAVE_STRCOLL)
/* Returns 1 if chars C and EQUIV collate equally in the current locale. */
static int
-collequiv (c, equiv)
- int c, equiv;
+collequiv (int c, int equiv)
{
if (charcmp (c, equiv, 1) == 0)
return 1;
@@ -168,9 +162,7 @@ collequiv (c, equiv)
#include "collsyms.h"
static int
-collsym (s, len)
- CHAR *s;
- int len;
+collsym (CHAR *s, int len)
{
register struct _collsym *csp;
char *x;
@@ -208,8 +200,7 @@ static char const *const cclass_name[] =
#define N_CHAR_CLASS (sizeof(cclass_name) / sizeof (cclass_name[0]))
static enum char_class
-is_valid_cclass (name)
- const char *name;
+is_valid_cclass (const char *name)
{
enum char_class ret;
int i;
@@ -229,9 +220,7 @@ is_valid_cclass (name)
}
static int
-cclass_test (c, char_class)
- int c;
- enum char_class char_class;
+cclass_test (int c, enum char_class char_class)
{
int result;
@@ -288,9 +277,7 @@ cclass_test (c, char_class)
}
static int
-is_cclass (c, name)
- int c;
- const char *name;
+is_cclass (int c, const char *name)
{
enum char_class char_class;
int result;
@@ -354,15 +341,15 @@ is_cclass (c, name)
# define STREQ(s1, s2) ((wcscmp (s1, s2) == 0))
# define STREQN(a, b, n) ((a)[0] == (b)[0] && wcsncmp(a, b, n) == 0)
-extern char *mbsmbchar PARAMS((const char *));
+extern char *mbsmbchar (const char *);
#if FNMATCH_EQUIV_FALLBACK
/* Construct a string w1 = "c1" and a pattern w2 = "[[=c2=]]" and pass them
to fnmatch to see if wide characters c1 and c2 collate as members of the
- same equivalence class. We can't really do this portably any other way */
+ same equivalence class. We can't really do this portably any other way
+ c1 == string char, c2 == patchar */
static int
-_fnmatch_fallback_wc (c1, c2)
- wchar_t c1, c2; /* string char, patchar */
+_fnmatch_fallback_wc (wchar_t c1, wchar_t c2)
{
char w1[MB_LEN_MAX+1]; /* string */
char w2[MB_LEN_MAX+8]; /* constructed pattern */
@@ -388,9 +375,7 @@ _fnmatch_fallback_wc (c1, c2)
#endif
static int
-charcmp_wc (c1, c2, forcecoll)
- wint_t c1, c2;
- int forcecoll;
+charcmp_wc (wint_t c1, wint_t c2, int forcecoll)
{
static wchar_t s1[2] = { L' ', L'\0' };
static wchar_t s2[2] = { L' ', L'\0' };
@@ -409,9 +394,7 @@ charcmp_wc (c1, c2, forcecoll)
}
static int
-rangecmp_wc (c1, c2, forcecoll)
- wint_t c1, c2;
- int forcecoll;
+rangecmp_wc (wint_t c1, wint_t c2, int forcecoll)
{
int r;
@@ -426,8 +409,7 @@ rangecmp_wc (c1, c2, forcecoll)
/* Returns 1 if wide chars C and EQUIV collate equally in the current locale. */
static int
-collequiv_wc (c, equiv)
- wint_t c, equiv;
+collequiv_wc (wint_t c, wint_t equiv)
{
wchar_t s, p;
@@ -454,9 +436,7 @@ collequiv_wc (c, equiv)
# include "collsyms.h"
static wint_t
-collwcsym (s, len)
- wchar_t *s;
- int len;
+collwcsym (wchar_t *s, int len)
{
register struct _collwcsym *csp;
@@ -471,9 +451,7 @@ collwcsym (s, len)
}
static int
-is_wcclass (wc, name)
- wint_t wc;
- wchar_t *name;
+is_wcclass (wint_t wc, wchar_t *name)
{
char *mbs;
mbstate_t state;
@@ -525,8 +503,7 @@ is_wcclass (wc, name)
This only uses single-byte code, but is only needed to support multibyte
locales. */
static int
-posix_cclass_only (pattern)
- char *pattern;
+posix_cclass_only (char *pattern)
{
char *p, *p1;
char cc[16]; /* sufficient for all valid posix char class names */
@@ -599,10 +576,7 @@ posix_cclass_only (pattern)
#endif /* HAVE_MULTIBYTE */
int
-xstrmatch (pattern, string, flags)
- char *pattern;
- char *string;
- int flags;
+xstrmatch (char *pattern, char *string, int flags)
{
#if HANDLE_MULTIBYTE
int ret;
diff --git a/lib/glob/strmatch.c b/lib/glob/strmatch.c
index 5b7b49fb..5a2c15f9 100644
--- a/lib/glob/strmatch.c
+++ b/lib/glob/strmatch.c
@@ -1,7 +1,7 @@
/* strmatch.c -- ksh-like extended pattern matching for the shell and filename
globbing. */
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -24,16 +24,13 @@
#include "stdc.h"
#include "strmatch.h"
-extern int xstrmatch PARAMS((char *, char *, int));
+extern int xstrmatch (char *, char *, int);
#if defined (HANDLE_MULTIBYTE)
-extern int internal_wstrmatch PARAMS((wchar_t *, wchar_t *, int));
+extern int internal_wstrmatch (wchar_t *, wchar_t *, int);
#endif
int
-strmatch (pattern, string, flags)
- char *pattern;
- char *string;
- int flags;
+strmatch (char *pattern, char *string, int flags)
{
if (string == 0 || pattern == 0)
return FNM_NOMATCH;
@@ -43,10 +40,7 @@ strmatch (pattern, string, flags)
#if defined (HANDLE_MULTIBYTE)
int
-wcsmatch (wpattern, wstring, flags)
- wchar_t *wpattern;
- wchar_t *wstring;
- int flags;
+wcsmatch (wchar_t *wpattern, wchar_t *wstring, int flags)
{
if (wstring == 0 || wpattern == 0)
return (FNM_NOMATCH);
diff --git a/lib/glob/strmatch.h b/lib/glob/strmatch.h
index d6a6b0fb..8cca1bd7 100644
--- a/lib/glob/strmatch.h
+++ b/lib/glob/strmatch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -56,10 +56,10 @@
/* Match STRING against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
-extern int strmatch PARAMS((char *, char *, int));
+extern int strmatch (char *, char *, int);
#if HANDLE_MULTIBYTE
-extern int wcsmatch PARAMS((wchar_t *, wchar_t *, int));
+extern int wcsmatch (wchar_t *, wchar_t *, int);
#endif
#endif /* _STRMATCH_H */
diff --git a/lib/glob/xmbsrtowcs.c b/lib/glob/xmbsrtowcs.c
index 17250c30..3ae56710 100644
--- a/lib/glob/xmbsrtowcs.c
+++ b/lib/glob/xmbsrtowcs.c
@@ -1,6 +1,6 @@
/* xmbsrtowcs.c -- replacement function for mbsrtowcs */
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -47,7 +47,7 @@ extern int errno;
#endif
#if ! HAVE_STRCHRNUL
-extern char *strchrnul PARAMS((const char *, int));
+extern char *strchrnul (const char *, int);
#endif
/* On some locales (ex. ja_JP.sjis), mbsrtowc doesn't convert 0x5c to U<0x5c>.
@@ -57,11 +57,7 @@ static mbstate_t local_state;
static int local_state_use = 0;
size_t
-xmbsrtowcs (dest, src, len, pstate)
- wchar_t *dest;
- const char **src;
- size_t len;
- mbstate_t *pstate;
+xmbsrtowcs (wchar_t *dest, const char **src, size_t len, mbstate_t *pstate)
{
mbstate_t *ps;
size_t mblength, wclength, n;
@@ -139,16 +135,15 @@ xmbsrtowcs (dest, src, len, pstate)
}
#if HAVE_MBSNRTOWCS
-/* Convert a multibyte string to a wide character string. Memory for the
- new wide character string is obtained with malloc.
+/* Convert a multibyte string SRC to a wide character string and store the
+ result in *DESTP. Memory for the new wide character string is obtained
+ with malloc.
Fast multiple-character version of xdupmbstowcs used when the indices are
not required and mbsnrtowcs is available. */
static size_t
-xdupmbstowcs2 (destp, src)
- wchar_t **destp; /* Store the pointer to the wide character string */
- const char *src; /* Multibyte character string */
+xdupmbstowcs2 (wchar_t **destp, const char *src)
{
const char *p; /* Conversion start position of src */
wchar_t *wsbuf; /* Buffer for wide characters. */
@@ -258,11 +253,12 @@ xdupmbstowcs2 (destp, src)
}
#endif /* HAVE_MBSNRTOWCS */
-/* Convert a multibyte string to a wide character string. Memory for the
- new wide character string is obtained with malloc.
+/* Convert a multibyte string SRC to a wide character string and store the
+ result in *DESTP. Memory for the new wide character string is obtained
+ with malloc.
The return value is the length of the wide character string. Returns a
- pointer to the wide character string in DESTP. If INDICESP is not NULL,
+ pointer to the wide character string in *DESTP. If INDICESP is not NULL,
INDICESP stores the pointer to the pointer array. Each pointer is to
the first byte of each multibyte character. Memory for the pointer array
is obtained with malloc, too.
@@ -270,10 +266,7 @@ xdupmbstowcs2 (destp, src)
of DESTP and INDICESP are NULL. */
size_t
-xdupmbstowcs (destp, indicesp, src)
- wchar_t **destp; /* Store the pointer to the wide character string */
- char ***indicesp; /* Store the pointer to the pointer array. */
- const char *src; /* Multibyte character string */
+xdupmbstowcs (wchar_t **destp, char ***indicesp, const char *src)
{
const char *p; /* Conversion start position of src */
wchar_t wc; /* Created wide character by conversion */
diff --git a/lib/intl/bindtextdom.c b/lib/intl/bindtextdom.c
index ef5479e3..f2c1482e 100644
--- a/lib/intl/bindtextdom.c
+++ b/lib/intl/bindtextdom.c
@@ -1,6 +1,6 @@
/* bindtextdom.c - Implementation of the bindtextdomain(3) function */
-/* Copyright (C) 1995-1998, 2000, 2001, 2002, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998, 2000, 2001, 2002, 2005-2009, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
@@ -89,9 +89,9 @@ __libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
#endif
/* Prototypes for local functions. */
-static void set_binding_values PARAMS ((const char *domainname,
+static void set_binding_values (const char *domainname,
const char **dirnamep,
- const char **codesetp));
+ const char **codesetp);
/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP
to be used for the DOMAINNAME message catalog.
diff --git a/lib/intl/dcigettext.c b/lib/intl/dcigettext.c
index c0f347e3..fac428de 100644
--- a/lib/intl/dcigettext.c
+++ b/lib/intl/dcigettext.c
@@ -1,6 +1,6 @@
/* dcigettext.c - Implementation of the internal dcigettext function. */
-/* Copyright (C) 1995-1999, 2000-2003, 2006-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000-2003, 2006-2009, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
@@ -157,10 +157,10 @@ char *getwd ();
char *getcwd ();
# endif
# ifndef HAVE_STPCPY
-static char *stpcpy PARAMS ((char *dest, const char *src));
+static char *stpcpy (char *dest, const char *src);
# endif
# ifndef HAVE_MEMPCPY
-static void *mempcpy PARAMS ((void *dest, const void *src, size_t n));
+static void *mempcpy (void *dest, const void *src, size_t n);
# endif
#endif
@@ -254,7 +254,7 @@ static void *root;
# endif
/* Function to compare two entries in the table of known translations. */
-static int transcmp PARAMS ((const void *p1, const void *p2));
+static int transcmp (const void *p1, const void *p2);
static int
transcmp (p1, p2)
const void *p1;
@@ -310,22 +310,20 @@ INTVARDEF (_nl_default_dirname)
struct binding *_nl_domain_bindings;
/* Prototypes for local functions. */
-static char *plural_lookup PARAMS ((struct loaded_l10nfile *domain,
+static inline char *plural_lookup (struct loaded_l10nfile *domain,
unsigned long int n,
const char *translation,
- size_t translation_len))
- internal_function;
-static const char *guess_category_value PARAMS ((int category,
- const char *categoryname))
- internal_function;
+ size_t translation_len);
+static inline const char *guess_category_value (int category,
+ const char *categoryname);
+
#ifdef _LIBC
# include "../locale/localeinfo.h"
# define category_to_name(category) _nl_category_names[category]
#else
-static const char *category_to_name PARAMS ((int category)) internal_function;
+static inline const char *category_to_name (int category);
#endif
-
/* For those loosing systems which don't have `alloca' we have to add
some additional code emulating it. */
#ifdef HAVE_ALLOCA
@@ -713,11 +711,11 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
#ifndef _LIBC
if (!ENABLE_SECURE)
{
- extern void _nl_log_untranslated PARAMS ((const char *logfilename,
+ extern void _nl_log_untranslated (const char *logfilename,
const char *domainname,
const char *msgid1,
const char *msgid2,
- int plural));
+ int plural);
const char *logfilename = getenv ("GETTEXT_LOG_UNTRANSLATED");
if (logfilename != NULL && logfilename[0] != '\0')
@@ -732,8 +730,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
}
-char *
-internal_function
+inline char *
_nl_find_msg (domain_file, domainbinding, msgid, lengthp)
struct loaded_l10nfile *domain_file;
struct binding *domainbinding;
@@ -1043,8 +1040,7 @@ _nl_find_msg (domain_file, domainbinding, msgid, lengthp)
/* Look up a plural variant. */
-static char *
-internal_function
+static inline char *
plural_lookup (domain, n, translation, translation_len)
struct loaded_l10nfile *domain;
unsigned long int n;
@@ -1084,8 +1080,7 @@ plural_lookup (domain, n, translation, translation_len)
#ifndef _LIBC
/* Return string representation of locale CATEGORY. */
-static const char *
-internal_function
+static inline const char *
category_to_name (category)
int category;
{
@@ -1145,8 +1140,7 @@ category_to_name (category)
#endif
/* Guess value of current locale from value of the environment variables. */
-static const char *
-internal_function
+static inline const char *
guess_category_value (category, categoryname)
int category;
const char *categoryname;
diff --git a/lib/intl/eval-plural.h b/lib/intl/eval-plural.h
index 3441c74e..74729576 100644
--- a/lib/intl/eval-plural.h
+++ b/lib/intl/eval-plural.h
@@ -1,6 +1,6 @@
/* eval-plural.c - Plural expression evaluation. */
-/* Copyright (C) 2000-2002, 2006-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2002, 2006-2009, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
@@ -18,18 +18,12 @@
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef STATIC
-#define STATIC static
-#endif
-
/* Evaluate the plural expression and return an index value. */
-STATIC unsigned long int plural_eval PARAMS ((struct expression *pexp,
- unsigned long int n))
- internal_function;
+static inline unsigned long int plural_eval (struct expression *pexp,
+ unsigned long int n);
-STATIC
+static inline
unsigned long int
-internal_function
plural_eval (pexp, n)
struct expression *pexp;
unsigned long int n;
diff --git a/lib/intl/finddomain.c b/lib/intl/finddomain.c
index 69a3586e..d7cae3b6 100644
--- a/lib/intl/finddomain.c
+++ b/lib/intl/finddomain.c
@@ -1,6 +1,6 @@
/* finddomain.c - Handle list of needed message catalogs */
-/* Copyright (C) 1995-1999, 2000, 2001, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001, 2005-2009, 2022 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.org>, 1995.
This file is part of GNU Bash.
@@ -47,8 +47,7 @@ static struct loaded_l10nfile *_nl_loaded_domains;
/* Return a data structure describing the message catalog described by
the DOMAINNAME and CATEGORY parameters with respect to the currently
established bindings. */
-struct loaded_l10nfile *
-internal_function
+inline struct loaded_l10nfile *
_nl_find_domain (dirname, locale, domainname, domainbinding)
const char *dirname;
char *locale;
diff --git a/lib/intl/gettextP.h b/lib/intl/gettextP.h
index 5c137e51..bf259fa6 100644
--- a/lib/intl/gettextP.h
+++ b/lib/intl/gettextP.h
@@ -1,6 +1,6 @@
/* gettextP.h - Header describing internals of libintl library. */
-/* Copyright (C) 1995-1999, 2000-2003, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000-2003, 2005-2009, 2022 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
This file is part of GNU Bash.
@@ -161,64 +161,64 @@ struct binding
extern int _nl_msg_cat_cntr;
#ifndef _LIBC
-const char *_nl_locale_name PARAMS ((int category, const char *categoryname));
+const char *_nl_locale_name (int category, const char *categoryname);
#endif
-struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
+struct loaded_l10nfile *_nl_find_domain (const char *__dirname,
char *__locale,
const char *__domainname,
- struct binding *__domainbinding))
+ struct binding *__domainbinding);
internal_function;
-void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
- struct binding *__domainbinding))
+void _nl_load_domain (struct loaded_l10nfile *__domain,
+ struct binding *__domainbinding);
internal_function;
-void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
+void _nl_unload_domain (struct loaded_domain *__domain);
internal_function;
-const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
+const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file,
struct loaded_domain *__domain,
- struct binding *__domainbinding))
+ struct binding *__domainbinding);
internal_function;
-void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
+void _nl_free_domain_conv (struct loaded_domain *__domain);
internal_function;
-char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
+char *_nl_find_msg (struct loaded_l10nfile *domain_file,
struct binding *domainbinding,
- const char *msgid, size_t *lengthp))
+ const char *msgid, size_t *lengthp);
internal_function;
#ifdef _LIBC
-extern char *__gettext PARAMS ((const char *__msgid));
-extern char *__dgettext PARAMS ((const char *__domainname,
- const char *__msgid));
-extern char *__dcgettext PARAMS ((const char *__domainname,
- const char *__msgid, int __category));
-extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
- unsigned long int __n));
-extern char *__dngettext PARAMS ((const char *__domainname,
+extern char *__gettext (const char *__msgid);
+extern char *__dgettext (const char *__domainname,
+ const char *__msgid);
+extern char *__dcgettext (const char *__domainname,
+ const char *__msgid, int __category);
+extern char *__ngettext (const char *__msgid1, const char *__msgid2,
+ unsigned long int __n);
+extern char *__dngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
- unsigned long int n));
-extern char *__dcngettext PARAMS ((const char *__domainname,
+ unsigned long int n);
+extern char *__dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
- unsigned long int __n, int __category));
-extern char *__dcigettext PARAMS ((const char *__domainname,
+ unsigned long int __n, int __category);
+extern char *__dcigettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
int __plural, unsigned long int __n,
- int __category));
-extern char *__textdomain PARAMS ((const char *__domainname));
-extern char *__bindtextdomain PARAMS ((const char *__domainname,
- const char *__dirname));
-extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
- const char *__codeset));
+ int __category);
+extern char *__textdomain (const char *__domainname);
+extern char *__bindtextdomain (const char *__domainname,
+ const char *__dirname);
+extern char *__bind_textdomain_codeset (const char *__domainname,
+ const char *__codeset);
#else
/* Declare the exported libintl_* functions, in a way that allows us to
call them under their real name. */
# define _INTL_REDIRECT_MACROS
# include "libgnuintl.h"
-extern char *libintl_dcigettext PARAMS ((const char *__domainname,
+extern char *libintl_dcigettext (const char *__domainname,
const char *__msgid1,
const char *__msgid2,
int __plural, unsigned long int __n,
- int __category));
+ int __category);
#endif
/* @@ begin of epilog @@ */
diff --git a/lib/intl/hash-string.h b/lib/intl/hash-string.h
index b5a7d413..b006d3d6 100644
--- a/lib/intl/hash-string.h
+++ b/lib/intl/hash-string.h
@@ -1,6 +1,6 @@
/* hash-string.h - Description of GNU message catalog format: string hashing function. */
-/* Copyright (C) 1995, 1997, 1998, 2000, 2001, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2000, 2001, 2005-2009, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
@@ -20,22 +20,13 @@
/* @@ end of prolog @@ */
-#ifndef PARAMS
-# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
-# define PARAMS(Args) Args
-# else
-# define PARAMS(Args) ()
-# endif
-#endif
-
/* We assume to have `unsigned long int' value with at least 32 bits. */
#define HASHWORDBITS 32
-
/* Defines the so called `hashpjw' function by P.J. Weinberger
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
1986, 1987 Bell Telephone Laboratories, Inc.] */
-static unsigned long int hash_string PARAMS ((const char *__str_param));
+static unsigned long int hash_string (const char *__str_param);
static inline unsigned long int
hash_string (str_param)
diff --git a/lib/intl/l10nflist.c b/lib/intl/l10nflist.c
index 4ce284a2..c6cc4598 100644
--- a/lib/intl/l10nflist.c
+++ b/lib/intl/l10nflist.c
@@ -1,6 +1,6 @@
/* l10nflist.c - make localization file list. */
-/* Copyright (C) 1995-1999, 2000, 2001, 2002, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2001, 2002, 2005-2009, 2022 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is part of GNU Bash.
@@ -61,7 +61,7 @@
# endif
#else
# ifndef HAVE_STPCPY
-static char *stpcpy PARAMS ((char *dest, const char *src));
+static char *stpcpy (char *dest, const char *src);
# endif
#endif
@@ -87,7 +87,7 @@ static char *stpcpy PARAMS ((char *dest, const char *src));
#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
/* Returns the number of strings in ARGZ. */
-static size_t argz_count__ PARAMS ((const char *argz, size_t len));
+static size_t argz_count__ (const char *argz, size_t len);
static size_t
argz_count__ (argz, len)
@@ -115,7 +115,7 @@ argz_count__ (argz, len)
#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
except the last into the character SEP. */
-static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
+static void argz_stringify__ (char *argz, size_t len, int sep);
static void
argz_stringify__ (argz, len, sep)
@@ -142,8 +142,8 @@ argz_stringify__ (argz, len, sep)
#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
-static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
- const char *entry));
+static char *argz_next__ (char *argz, size_t argz_len,
+ const char *entry);
static char *
argz_next__ (argz, argz_len, entry)
@@ -170,7 +170,7 @@ argz_next__ (argz, argz_len, entry)
/* Return number of bits set in X. */
-static int pop PARAMS ((int x));
+static int pop (int x);
static inline int
pop (x)
diff --git a/lib/intl/loadinfo.h b/lib/intl/loadinfo.h
index d06a2773..dd5a4efe 100644
--- a/lib/intl/loadinfo.h
+++ b/lib/intl/loadinfo.h
@@ -1,6 +1,6 @@
/* loadinfo.c */
-/* Copyright (C) 1996-1999, 2000-2002, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999, 2000-2002, 2005-2009, 2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -92,8 +92,8 @@ struct loaded_l10nfile
names. Normalization allows the user to use any of the common
names. The return value is dynamically allocated and has to be
freed by the caller. */
-extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
- size_t name_len));
+extern const char *_nl_normalize_codeset (const char *codeset,
+ size_t name_len);
/* Lookup a locale dependent file.
*L10NFILE_LIST denotes a pool of lookup results of locale dependent
@@ -110,19 +110,19 @@ extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
furthermore its ->successor[] field contains a list of other lookup
results from which this lookup result inherits. */
extern struct loaded_l10nfile *
-_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
+_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
const char *dirlist, size_t dirlist_len, int mask,
const char *language, const char *territory,
const char *codeset,
const char *normalized_codeset,
const char *modifier, const char *special,
const char *sponsor, const char *revision,
- const char *filename, int do_allocate));
+ const char *filename, int do_allocate);
/* Lookup the real locale name for a locale alias NAME, or NULL if
NAME is not a locale alias (but possibly a real locale name).
The return value is statically allocated and must not be freed. */
-extern const char *_nl_expand_alias PARAMS ((const char *name));
+extern const char *_nl_expand_alias (const char *name);
/* Split a locale name NAME into its pieces: language, modifier,
territory, codeset, special, sponsor, revision.
@@ -142,18 +142,18 @@ extern const char *_nl_expand_alias PARAMS ((const char *name));
CEN_SPONSOR for *SPONSOR,
CEN_REVISION for *REVISION.
*/
-extern int _nl_explode_name PARAMS ((char *name, const char **language,
+extern int _nl_explode_name (char *name, const char **language,
const char **modifier,
const char **territory,
const char **codeset,
const char **normalized_codeset,
const char **special,
const char **sponsor,
- const char **revision));
+ const char **revision);
/* Split a locale name NAME into a leading language part and all the
rest. Return a pointer to the first character after the language,
i.e. to the first byte of the rest. */
-extern char *_nl_find_language PARAMS ((const char *name));
+extern char *_nl_find_language (const char *name);
#endif /* loadinfo.h */
diff --git a/lib/intl/loadmsgcat.c b/lib/intl/loadmsgcat.c
index adbd7b4f..7485e6d1 100644
--- a/lib/intl/loadmsgcat.c
+++ b/lib/intl/loadmsgcat.c
@@ -1,6 +1,6 @@
/* loadmsgcat.c - Load needed message catalogs. */
-/* Copyright (C) 1995-1999, 2000-2003, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000-2003, 2005-2009, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
@@ -495,7 +495,7 @@ char *alloca ();
/* Prototypes for local functions. Needed to ensure compiler checking of
function argument counts despite of K&R C function definition syntax. */
-static const char *get_sysdep_segment_value PARAMS ((const char *name));
+static const char *get_sysdep_segment_value (const char *name);
/* We need a sign, whether a new catalog was loaded, which can be associated
@@ -762,8 +762,7 @@ get_sysdep_segment_value (name)
/* Initialize the codeset dependent parts of an opened message catalog.
Return the header entry. */
-const char *
-internal_function
+const inline char *
_nl_init_domain_conv (domain_file, domain, domainbinding)
struct loaded_l10nfile *domain_file;
struct loaded_domain *domain;
@@ -831,7 +830,7 @@ _nl_init_domain_conv (domain_file, domain, domainbinding)
outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
# else
# if HAVE_ICONV
- extern const char *locale_charset PARAMS ((void));
+ extern const char *locale_charset (void);
outcharset = locale_charset ();
# endif
# endif
@@ -881,8 +880,7 @@ _nl_init_domain_conv (domain_file, domain, domainbinding)
}
/* Frees the codeset dependent parts of an opened message catalog. */
-void
-internal_function
+inline void
_nl_free_domain_conv (domain)
struct loaded_domain *domain;
{
@@ -902,8 +900,7 @@ _nl_free_domain_conv (domain)
/* Load the message catalogs specified by FILENAME. If it is no valid
message catalog do nothing. */
-void
-internal_function
+inline void
_nl_load_domain (domain_file, domainbinding)
struct loaded_l10nfile *domain_file;
struct binding *domainbinding;
@@ -1311,8 +1308,7 @@ _nl_load_domain (domain_file, domainbinding)
#ifdef _LIBC
-void
-internal_function
+inline void
_nl_unload_domain (domain)
struct loaded_domain *domain;
{
diff --git a/lib/intl/localealias.c b/lib/intl/localealias.c
index 7a730dbf..27a1f5c6 100644
--- a/lib/intl/localealias.c
+++ b/lib/intl/localealias.c
@@ -1,6 +1,6 @@
/* localealias.c - Handle aliases for locale names. */
-/* Copyright (C) 1995-1999, 2000-2001, 2003, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000-2001, 2003, 2005-2009, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
@@ -90,10 +90,6 @@ char *alloca ();
__libc_lock_define_initialized (static, lock);
#endif
-#ifndef internal_function
-# define internal_function
-#endif
-
/* Some optimizations for glibc. */
#ifdef _LIBC
# define FEOF(fp) feof_unlocked (fp)
@@ -142,12 +138,10 @@ static size_t maxmap;
/* Prototypes for local functions. */
-static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
- internal_function;
-static int extend_alias_table PARAMS ((void));
-static int alias_compare PARAMS ((const struct alias_map *map1,
- const struct alias_map *map2));
-
+static inline size_t read_alias_file (const char *fname, int fname_len);
+static int extend_alias_table (void);
+static int alias_compare (const struct alias_map *map1,
+ const struct alias_map *map2);
const char *
_nl_expand_alias (name)
@@ -174,8 +168,8 @@ _nl_expand_alias (name)
if (nmap > 0)
retval = (struct alias_map *) bsearch (&item, map, nmap,
sizeof (struct alias_map),
- (int (*) PARAMS ((const void *,
- const void *))
+ (int (*) (const void *,
+ const void *)
) alias_compare);
else
retval = NULL;
@@ -215,8 +209,7 @@ _nl_expand_alias (name)
}
-static size_t
-internal_function
+static inline size_t
read_alias_file (fname, fname_len)
const char *fname;
int fname_len;
@@ -369,7 +362,7 @@ read_alias_file (fname, fname_len)
if (added > 0)
qsort (map, nmap, sizeof (struct alias_map),
- (int (*) PARAMS ((const void *, const void *))) alias_compare);
+ (int (*) (const void *, const void *)) alias_compare);
return added;
}
diff --git a/lib/intl/plural-exp.c b/lib/intl/plural-exp.c
index 9ed3b16f..0580d967 100644
--- a/lib/intl/plural-exp.c
+++ b/lib/intl/plural-exp.c
@@ -1,6 +1,6 @@
/* plural-exp.c - Expression parsing for plural form selection. */
-/* Copyright (C) 2000, 2001, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2005-2009, 2022 Free Software Foundation, Inc.`
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This file is part of GNU Bash.
@@ -96,8 +96,7 @@ init_germanic_plural ()
#endif
-void
-internal_function
+inline void
EXTRACT_PLURAL_EXPRESSION (nullentry, pluralp, npluralsp)
const char *nullentry;
struct expression **pluralp;
diff --git a/lib/intl/plural-exp.h b/lib/intl/plural-exp.h
index dcb0dae0..b644f63c 100644
--- a/lib/intl/plural-exp.h
+++ b/lib/intl/plural-exp.h
@@ -1,6 +1,6 @@
/* plural-exp.h - defines for expression parsing and evaluation for plural form selection. */
-/* Copyright (C) 2000, 2001, 2002, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2005-2009, 2022 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This file is part of GNU Bash.
@@ -22,14 +22,6 @@
#ifndef _PLURAL_EXP_H
#define _PLURAL_EXP_H
-#ifndef PARAMS
-# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
-# define PARAMS(args) args
-# else
-# define PARAMS(args) ()
-# endif
-#endif
-
#ifndef internal_function
# define internal_function
#endif
@@ -38,7 +30,6 @@
# define attribute_hidden
#endif
-
/* This is the representation of the expressions to determine the
plural form. */
struct expression
@@ -111,18 +102,18 @@ struct parse_args
# define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
#endif
-extern void FREE_EXPRESSION PARAMS ((struct expression *exp))
+extern void FREE_EXPRESSION (struct expression *exp)
internal_function;
-extern int PLURAL_PARSE PARAMS ((void *arg));
+extern int PLURAL_PARSE (void *arg);
extern struct expression GERMANIC_PLURAL attribute_hidden;
-extern void EXTRACT_PLURAL_EXPRESSION PARAMS ((const char *nullentry,
+extern void EXTRACT_PLURAL_EXPRESSION (const char *nullentry,
struct expression **pluralp,
- unsigned long int *npluralsp))
+ unsigned long int *npluralsp)
internal_function;
#if !defined (_LIBC) && !defined (IN_LIBINTL)
-extern unsigned long int plural_eval PARAMS ((struct expression *pexp,
- unsigned long int n));
+extern unsigned long int plural_eval (struct expression *pexp,
+ unsigned long int n);
#endif
#endif /* _PLURAL_EXP_H */
diff --git a/lib/intl/plural.c b/lib/intl/plural.c
index a0031513..4a8ea39a 100644
--- a/lib/intl/plural.c
+++ b/lib/intl/plural.c
@@ -1,7 +1,7 @@
/* A Bison parser, made by GNU Bison 2.0. */
/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
@@ -161,20 +161,20 @@ typedef union YYSTYPE {
#line 57 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
/* Prototypes for local functions. */
-static struct expression *new_exp PARAMS ((int nargs, enum operator op,
- struct expression * const *args));
-static inline struct expression *new_exp_0 PARAMS ((enum operator op));
-static inline struct expression *new_exp_1 PARAMS ((enum operator op,
- struct expression *right));
-static struct expression *new_exp_2 PARAMS ((enum operator op,
+static struct expression *new_exp (int nargs, enum operator op,
+ struct expression * const *args);
+static inline struct expression *new_exp_0 (enum operator op);
+static inline struct expression *new_exp_1 (enum operator op,
+ struct expression *right);
+static struct expression *new_exp_2 (enum operator op,
struct expression *left,
- struct expression *right));
-static inline struct expression *new_exp_3 PARAMS ((enum operator op,
+ struct expression *right);
+static inline struct expression *new_exp_3 (enum operator op,
struct expression *bexp,
struct expression *tbranch,
- struct expression *fbranch));
-static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
-static void yyerror PARAMS ((const char *str));
+ struct expression *fbranch);
+static int yylex (YYSTYPE *lval, const char **pexp);
+static void yyerror (const char *str);
/* Allocation of expressions. */
@@ -1498,8 +1498,7 @@ yyreturn:
#line 231 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
-void
-internal_function
+inline void
FREE_EXPRESSION (exp)
struct expression *exp;
{
diff --git a/lib/intl/plural.y b/lib/intl/plural.y
index 8b8cec7e..96dcdc50 100644
--- a/lib/intl/plural.y
+++ b/lib/intl/plural.y
@@ -1,7 +1,7 @@
%{
/* plural.y - Expression parsing for plural form selection. */
-/* Copyright (C) 2000, 2001, 2005-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2005-2009, 2022 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
This file is part of GNU Bash.
@@ -56,20 +56,20 @@
%{
/* Prototypes for local functions. */
-static struct expression *new_exp PARAMS ((int nargs, enum operator op,
- struct expression * const *args));
-static inline struct expression *new_exp_0 PARAMS ((enum operator op));
-static inline struct expression *new_exp_1 PARAMS ((enum operator op,
- struct expression *right));
-static struct expression *new_exp_2 PARAMS ((enum operator op,
+static struct expression *new_exp (int nargs, enum operator op,
+ struct expression * const *args);
+static inline struct expression *new_exp_0 (enum operator op);
+static inline struct expression *new_exp_1 (enum operator op,
+ struct expression *right);
+static struct expression *new_exp_2 (enum operator op,
struct expression *left,
- struct expression *right));
-static inline struct expression *new_exp_3 PARAMS ((enum operator op,
+ struct expression *right);
+static inline struct expression *new_exp_3 (enum operator op,
struct expression *bexp,
struct expression *tbranch,
- struct expression *fbranch));
-static int yylex PARAMS ((YYSTYPE *lval, const char **pexp));
-static void yyerror PARAMS ((const char *str));
+ struct expression *fbranch);
+static int yylex (YYSTYPE *lval, const char **pexp);
+static void yyerror (const char *str);
/* Allocation of expressions. */
@@ -230,8 +230,7 @@ exp: exp '?' exp ':' exp
%%
-void
-internal_function
+inline void
FREE_EXPRESSION (exp)
struct expression *exp;
{
diff --git a/lib/malloc/alloca.c b/lib/malloc/alloca.c
index 26319c2d..7627e164 100644
--- a/lib/malloc/alloca.c
+++ b/lib/malloc/alloca.c
@@ -77,7 +77,7 @@ typedef char *pointer;
#ifndef emacs
#define malloc xmalloc
-extern pointer xmalloc ();
+extern pointer xmalloc (size_t);
#endif
/* Define STACK_DIRECTION if you know the direction of stack
@@ -102,7 +102,7 @@ static int stack_dir; /* 1 or -1 once known. */
#define STACK_DIR stack_dir
static void
-find_stack_direction ()
+find_stack_direction (void)
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
@@ -156,8 +156,7 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
implementations of C, for example under Gould's UTX/32. */
pointer
-alloca (size)
- size_t size;
+alloca (size_t size)
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
diff --git a/lib/malloc/imalloc.h b/lib/malloc/imalloc.h
index bebd1364..16c0c671 100644
--- a/lib/malloc/imalloc.h
+++ b/lib/malloc/imalloc.h
@@ -1,6 +1,6 @@
/* imalloc.h -- internal malloc definitions shared by source files. */
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -172,7 +172,7 @@ do { \
#include <signal.h>
-extern void _malloc_block_signals PARAMS((sigset_t *, sigset_t *));
-extern void _malloc_unblock_signals PARAMS((sigset_t *, sigset_t *));
+extern void _malloc_block_signals (sigset_t *, sigset_t *);
+extern void _malloc_unblock_signals (sigset_t *, sigset_t *);
#endif /* _IMALLOC_H */
diff --git a/lib/malloc/malloc.c b/lib/malloc/malloc.c
index f61f0271..180c3dc4 100644
--- a/lib/malloc/malloc.c
+++ b/lib/malloc/malloc.c
@@ -1,6 +1,6 @@
/* malloc.c - dynamic memory allocation for bash. */
-/* Copyright (C) 1985-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1985-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -308,33 +308,33 @@ extern int errno;
#endif
/* Declarations for internal functions */
-static PTR_T internal_malloc PARAMS((size_t, const char *, int, int));
-static PTR_T internal_realloc PARAMS((PTR_T, size_t, const char *, int, int));
-static void internal_free PARAMS((PTR_T, const char *, int, int));
-static PTR_T internal_memalign PARAMS((size_t, size_t, const char *, int, int));
+static PTR_T internal_malloc (size_t, const char *, int, int);
+static PTR_T internal_realloc (PTR_T, size_t, const char *, int, int);
+static void internal_free (PTR_T, const char *, int, int);
+static PTR_T internal_memalign (size_t, size_t, const char *, int, int);
#ifndef NO_CALLOC
-static PTR_T internal_calloc PARAMS((size_t, size_t, const char *, int, int));
-static void internal_cfree PARAMS((PTR_T, const char *, int, int));
+static PTR_T internal_calloc (size_t, size_t, const char *, int, int);
+static void internal_cfree (PTR_T, const char *, int, int);
#endif
#ifndef NO_VALLOC
-static PTR_T internal_valloc PARAMS((size_t, const char *, int, int));
+static PTR_T internal_valloc (size_t, const char *, int, int);
#endif
-static PTR_T internal_remap PARAMS((PTR_T, size_t, int, int));
+static PTR_T internal_remap (PTR_T, size_t, int, int);
#if defined (botch)
extern void botch ();
#else
-static void botch PARAMS((const char *, const char *, int));
+static void botch (const char *, const char *, int);
#endif
-static void xbotch PARAMS((PTR_T, int, const char *, const char *, int));
+static void xbotch (PTR_T, int, const char *, const char *, int);
#if !HAVE_DECL_SBRK
-extern char *sbrk ();
+extern char *sbrk (int);
#endif /* !HAVE_DECL_SBRK */
#ifdef SHELL
extern int running_trap;
-extern int signal_is_trapped PARAMS((int));
+extern int signal_is_trapped (int);
#endif
#ifdef MALLOC_STATS
@@ -353,16 +353,13 @@ int malloc_mmap_threshold = MMAP_THRESHOLD;
char _malloc_trace_buckets[NBUCKETS];
/* These should really go into a header file. */
-extern void mtrace_alloc PARAMS((const char *, PTR_T, size_t, const char *, int));
-extern void mtrace_free PARAMS((PTR_T, int, const char *, int));
+extern void mtrace_alloc (const char *, PTR_T, size_t, const char *, int);
+extern void mtrace_free (PTR_T, int, const char *, int);
#endif
#if !defined (botch)
static void
-botch (s, file, line)
- const char *s;
- const char *file;
- int line;
+botch (const char *s, const char *file, int line)
{
fprintf (stderr, _("malloc: failed assertion: %s\n"), s);
(void)fflush (stderr);
@@ -373,12 +370,7 @@ botch (s, file, line)
/* print the file and line number that caused the assertion failure and
call botch() to do whatever the application wants with the information */
static void
-xbotch (mem, e, s, file, line)
- PTR_T mem;
- int e;
- const char *s;
- const char *file;
- int line;
+xbotch (PTR_T mem, int e, const char *s, const char *file, int line)
{
fprintf (stderr, _("\r\nmalloc: %s:%d: assertion botched\r\n"),
file ? file : _("unknown"), line);
@@ -395,8 +387,7 @@ xbotch (mem, e, s, file, line)
assumed to not be busy; the caller (morecore()) checks for this.
BUSY[NU] must be set to 1. */
static void
-bcoalesce (nu)
- register int nu;
+bcoalesce (register int nu)
{
register union mhead *mp, *mp1, *mp2;
register int nbuck;
@@ -464,8 +455,7 @@ bcoalesce (nu)
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 (nu)
- register int nu;
+bsplit (register int nu)
{
register union mhead *mp;
int nbuck, nblks, split_max;
@@ -529,9 +519,7 @@ bsplit (nu)
/* Take the memory block MP and add it to a chain < NU. NU is the right bucket,
but is busy. This avoids memory orphaning. */
static void
-xsplit (mp, nu)
- union mhead *mp;
- int nu;
+xsplit (union mhead *mp, int nu)
{
union mhead *nh;
int nbuck, nblks, split_max;
@@ -570,8 +558,7 @@ xsplit (mp, nu)
}
void
-_malloc_block_signals (setp, osetp)
- sigset_t *setp, *osetp;
+_malloc_block_signals (sigset_t *setp, sigset_t *osetp)
{
#ifdef HAVE_POSIX_SIGNALS
sigfillset (setp);
@@ -585,8 +572,7 @@ _malloc_block_signals (setp, osetp)
}
void
-_malloc_unblock_signals (setp, osetp)
- sigset_t *setp, *osetp;
+_malloc_unblock_signals (sigset_t *setp, sigset_t *osetp)
{
#ifdef HAVE_POSIX_SIGNALS
sigprocmask (SIG_SETMASK, osetp, (sigset_t *)NULL);
@@ -600,10 +586,9 @@ _malloc_unblock_signals (setp, osetp)
#if defined (USE_LESSCORE)
/* Return some memory to the system by reducing the break. This is only
called with NU > pagebucket, so we're always assured of giving back
- more than one page of memory. */
+ more than one page of memory. NU is the size index we're discarding */
static void
-lesscore (nu) /* give system back some memory */
- register int nu; /* size index we're discarding */
+lesscore (int nu)
{
long siz;
@@ -622,8 +607,7 @@ lesscore (nu) /* give system back some memory */
/* Ask system for more memory; add to NEXTF[NU]. BUSY[NU] must be set to 1. */
static void
-morecore (nu)
- register int nu; /* size index to get more of */
+morecore (int nu)
{
register union mhead *mp;
register int nblks;
@@ -752,13 +736,13 @@ morecore_done:
}
static void
-malloc_debug_dummy ()
+malloc_debug_dummy (void)
{
write (1, "malloc_debug_dummy\n", 19);
}
static int
-pagealign ()
+pagealign (void)
{
register int nunits;
register union mhead *mp;
@@ -823,12 +807,10 @@ pagealign ()
return 0;
}
-
+
+/* allocate a block of memory */
static PTR_T
-internal_malloc (n, file, line, flags) /* get a block */
- size_t n;
- const char *file;
- int line, flags;
+internal_malloc (size_t n, const char *file, int line, int flags)
{
register union mhead *p;
register int nunits;
@@ -947,10 +929,7 @@ internal_malloc (n, file, line, flags) /* get a block */
}
static void
-internal_free (mem, file, line, flags)
- PTR_T mem;
- const char *file;
- int line, flags;
+internal_free (PTR_T mem, const char *file, int line, int flags)
{
register union mhead *p;
register char *ap, *z;
@@ -1096,11 +1075,7 @@ free_return:
new size, call mremap with the new size, and add the bookkeeping and guard
information back in. */
static PTR_T
-internal_remap (mem, n, nunits, flags)
- PTR_T mem;
- register size_t n;
- int nunits;
- int flags;
+internal_remap (PTR_T mem, register size_t n, int nunits, int flags)
{
register union mhead *p, *np;
char *m, *z;
@@ -1143,11 +1118,7 @@ internal_remap (mem, n, nunits, flags)
#endif
static PTR_T
-internal_realloc (mem, n, file, line, flags)
- PTR_T mem;
- register size_t n;
- const char *file;
- int line, flags;
+internal_realloc (PTR_T mem, size_t n, const char *file, int line, int flags)
{
register union mhead *p;
register MALLOC_SIZE_T tocopy;
@@ -1294,11 +1265,7 @@ internal_realloc (mem, n, file, line, flags)
}
static PTR_T
-internal_memalign (alignment, size, file, line, flags)
- size_t alignment;
- size_t size;
- const char *file;
- int line, flags;
+internal_memalign (size_t alignment, size_t size, const char *file, int line, int flags)
{
register char *ptr;
register char *aligned;
@@ -1324,9 +1291,7 @@ internal_memalign (alignment, size, file, line, flags)
}
int
-posix_memalign (memptr, alignment, size)
- void **memptr;
- size_t alignment, size;
+posix_memalign (void **memptr, size_t alignment, size_t size)
{
void *mem;
@@ -1346,8 +1311,7 @@ posix_memalign (memptr, alignment, size)
}
size_t
-malloc_usable_size (mem)
- void *mem;
+malloc_usable_size (void *mem)
{
register union mhead *p;
register char *ap;
@@ -1376,10 +1340,7 @@ malloc_usable_size (mem)
/* This runs into trouble with getpagesize on HPUX, and Multimax machines.
Patching out seems cleaner than the ugly fix needed. */
static PTR_T
-internal_valloc (size, file, line, flags)
- size_t size;
- const char *file;
- int line, flags;
+internal_valloc (size_t size, const char *file, int line, int flags)
{
return internal_memalign (getpagesize (), size, file, line, flags|MALLOC_INTERNAL);
}
@@ -1387,10 +1348,7 @@ internal_valloc (size, file, line, flags)
#ifndef NO_CALLOC
static PTR_T
-internal_calloc (n, s, file, line, flags)
- size_t n, s;
- const char *file;
- int line, flags;
+internal_calloc (size_t n, size_t s, const char *file, int line, int flags)
{
size_t total;
PTR_T result;
@@ -1403,10 +1361,7 @@ internal_calloc (n, s, file, line, flags)
}
static void
-internal_cfree (p, file, line, flags)
- PTR_T p;
- const char *file;
- int line, flags;
+internal_cfree (PTR_T p, const char *file, int line, int flags)
{
internal_free (p, file, line, flags|MALLOC_INTERNAL);
}
@@ -1414,8 +1369,7 @@ internal_cfree (p, file, line, flags)
#ifdef MALLOC_STATS
int
-malloc_free_blocks (size)
- int size;
+malloc_free_blocks (int size)
{
int nfree;
register union mhead *p;
@@ -1430,58 +1384,38 @@ malloc_free_blocks (size)
#if defined (MALLOC_WRAPFUNCS)
PTR_T
-sh_malloc (bytes, file, line)
- size_t bytes;
- const char *file;
- int line;
+sh_malloc (size_t bytes, const char *file, int line)
{
return internal_malloc (bytes, file, line, MALLOC_WRAPPER);
}
PTR_T
-sh_realloc (ptr, size, file, line)
- PTR_T ptr;
- size_t size;
- const char *file;
- int line;
+sh_realloc (PTR_T ptr, size_t size, const char *file, int line)
{
return internal_realloc (ptr, size, file, line, MALLOC_WRAPPER);
}
void
-sh_free (mem, file, line)
- PTR_T mem;
- const char *file;
- int line;
+sh_free (PTR_T mem, const char *file, int line)
{
internal_free (mem, file, line, MALLOC_WRAPPER);
}
PTR_T
-sh_memalign (alignment, size, file, line)
- size_t alignment;
- size_t size;
- const char *file;
- int line;
+sh_memalign (size_t alignment, size_t size, const char *file, int line)
{
return internal_memalign (alignment, size, file, line, MALLOC_WRAPPER);
}
#ifndef NO_CALLOC
PTR_T
-sh_calloc (n, s, file, line)
- size_t n, s;
- const char *file;
- int line;
+sh_calloc (size_t n, size_t s, const char *file, int line)
{
return internal_calloc (n, s, file, line, MALLOC_WRAPPER);
}
void
-sh_cfree (mem, file, line)
- PTR_T mem;
- const char *file;
- int line;
+sh_cfree (PTR_T mem, const char *file, int line)
{
internal_cfree (mem, file, line, MALLOC_WRAPPER);
}
@@ -1489,10 +1423,7 @@ sh_cfree (mem, file, line)
#ifndef NO_VALLOC
PTR_T
-sh_valloc (size, file, line)
- size_t size;
- const char *file;
- int line;
+sh_valloc (size_t size, const char *file, int line)
{
return internal_valloc (size, file, line, MALLOC_WRAPPER);
}
@@ -1503,39 +1434,32 @@ sh_valloc (size, file, line)
/* Externally-available functions that call their internal counterparts. */
PTR_T
-malloc (size)
- size_t size;
+malloc (size_t size)
{
return internal_malloc (size, (char *)NULL, 0, 0);
}
PTR_T
-realloc (mem, nbytes)
- PTR_T mem;
- size_t nbytes;
+realloc (PTR_T mem, size_t nbytes)
{
return internal_realloc (mem, nbytes, (char *)NULL, 0, 0);
}
void
-free (mem)
- PTR_T mem;
+free (PTR_T mem)
{
internal_free (mem, (char *)NULL, 0, 0);
}
PTR_T
-memalign (alignment, size)
- size_t alignment;
- size_t size;
+memalign (size_t alignment, size_t size)
{
return internal_memalign (alignment, size, (char *)NULL, 0, 0);
}
#ifndef NO_VALLOC
PTR_T
-valloc (size)
- size_t size;
+valloc (size_t size)
{
return internal_valloc (size, (char *)NULL, 0, 0);
}
@@ -1543,15 +1467,13 @@ valloc (size)
#ifndef NO_CALLOC
PTR_T
-calloc (n, s)
- size_t n, s;
+calloc (size_t n, size_t s)
{
return internal_calloc (n, s, (char *)NULL, 0, 0);
}
void
-cfree (mem)
- PTR_T mem;
+cfree (PTR_T mem)
{
internal_cfree (mem, (char *)NULL, 0, 0);
}
diff --git a/lib/malloc/mstats.h b/lib/malloc/mstats.h
index aa3fa33b..234725ed 100644
--- a/lib/malloc/mstats.h
+++ b/lib/malloc/mstats.h
@@ -1,6 +1,6 @@
/* mstats.h - definitions for malloc statistics */
-/* Copyright (C) 2001-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -104,10 +104,10 @@ struct bucket_stats {
int nmmap; /* currently unused */
};
-extern struct bucket_stats malloc_bucket_stats PARAMS((int));
-extern struct _malstats malloc_stats PARAMS((void));
-extern void print_malloc_stats PARAMS((char *));
-extern void trace_malloc_stats PARAMS((char *, char *));
+extern struct bucket_stats malloc_bucket_stats (int);
+extern struct _malstats malloc_stats (void);
+extern void print_malloc_stats (char *);
+extern void trace_malloc_stats (char *, char *);
#endif /* MALLOC_STATS */
diff --git a/lib/malloc/shmalloc.h b/lib/malloc/shmalloc.h
index d51193eb..1213169d 100644
--- a/lib/malloc/shmalloc.h
+++ b/lib/malloc/shmalloc.h
@@ -1,6 +1,7 @@
/* Functions (currently) for use by the shell to do malloc debugging and
tracking. */
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -21,14 +22,6 @@
#ifndef _SH_MALLOC_H
#define _SH_MALLOC_H
-#ifndef PARAMS
-# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
-# define PARAMS(protos) protos
-# else
-# define PARAMS(protos) ()
-# endif
-#endif
-
/* Generic pointer type. */
#ifndef PTR_T
@@ -41,30 +34,30 @@
#endif /* PTR_T */
-extern PTR_T sh_malloc PARAMS((size_t, const char *, int));
-extern PTR_T sh_realloc PARAMS((PTR_T, size_t, const char *, int));
-extern void sh_free PARAMS((PTR_T, const char *, int));
+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);
-extern PTR_T sh_memalign PARAMS((size_t, size_t, const char *, int));
+extern PTR_T sh_memalign (size_t, size_t, const char *, int);
-extern PTR_T sh_calloc PARAMS((size_t, size_t, const char *, int));
-extern void sh_cfree PARAMS((PTR_T, const char *, int));
+extern PTR_T sh_calloc (size_t, size_t, const char *, int);
+extern void sh_cfree (PTR_T, const char *, int);
-extern PTR_T sh_valloc PARAMS((size_t, const char *, int));
+extern PTR_T sh_valloc (size_t, const char *, int);
/* trace.c */
-extern int malloc_set_trace PARAMS((int));
+extern int malloc_set_trace (int);
extern void malloc_set_tracefp (); /* full prototype requires stdio.h */
-extern void malloc_set_tracefn PARAMS((char *, char *));
+extern void malloc_set_tracefn (char *, char *);
/* table.c */
-extern void mregister_dump_table PARAMS((void));
-extern void mregister_table_init PARAMS((void));
-extern int malloc_set_register PARAMS((int));
+extern void mregister_dump_table (void);
+extern void mregister_table_init (void);
+extern int malloc_set_register (int);
/* stats.c */
-extern void print_malloc_stats PARAMS((char *));
+extern void print_malloc_stats (char *);
extern void fprint_malloc_stats (); /* full prototype requires stdio.h */
-extern void trace_malloc_stats PARAMS((char *, char *));
+extern void trace_malloc_stats (char *, char *);
#endif
diff --git a/lib/malloc/stats.c b/lib/malloc/stats.c
index b38df9f4..a26d44a7 100644
--- a/lib/malloc/stats.c
+++ b/lib/malloc/stats.c
@@ -1,6 +1,6 @@
/* stats.c - malloc statistics */
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -34,17 +34,16 @@
#include "mstats.h"
-extern int malloc_free_blocks PARAMS((int));
+extern int malloc_free_blocks (int);
extern int malloc_mmap_threshold;
extern struct _malstats _mstats;
-extern FILE *_imalloc_fopen PARAMS((char *, char *, char *, char *, size_t));
+extern FILE *_imalloc_fopen (char *, char *, char *, char *, size_t);
struct bucket_stats
-malloc_bucket_stats (size)
- int size;
+malloc_bucket_stats (int size)
{
struct bucket_stats v;
@@ -75,7 +74,7 @@ malloc_bucket_stats (size)
is the total number of bytes in use. These two fields are fairly
expensive to compute, so we do it only when asked to. */
struct _malstats
-malloc_stats ()
+malloc_stats (void)
{
struct _malstats result;
struct bucket_stats v;
@@ -93,9 +92,7 @@ malloc_stats ()
}
static void
-_print_malloc_stats (s, fp)
- char *s;
- FILE *fp;
+_print_malloc_stats (char *s, FILE *fp)
{
register int i;
unsigned long totused, totfree;
@@ -128,16 +125,13 @@ _print_malloc_stats (s, fp)
}
void
-print_malloc_stats (s)
- char *s;
+print_malloc_stats (char *s)
{
_print_malloc_stats (s, stderr);
}
void
-fprint_malloc_stats (s, fp)
- char *s;
- FILE *fp;
+fprint_malloc_stats (char *s, FILE *fp)
{
_print_malloc_stats (s, fp);
}
@@ -145,8 +139,7 @@ fprint_malloc_stats (s, fp)
#define TRACEROOT "/var/tmp/maltrace/stats."
void
-trace_malloc_stats (s, fn)
- char *s, *fn;
+trace_malloc_stats (char *s, char *fn)
{
FILE *fp;
char defname[sizeof (TRACEROOT) + 64];
@@ -166,12 +159,7 @@ trace_malloc_stats (s, fn)
#if defined (MALLOC_STATS) || defined (MALLOC_TRACE)
FILE *
-_imalloc_fopen (s, fn, def, defbuf, defsiz)
- char *s;
- char *fn;
- char *def;
- char *defbuf;
- size_t defsiz;
+_imalloc_fopen (char *s, char *fn, char *def, char *defbuf, size_t defsiz)
{
char fname[1024];
long l;
diff --git a/lib/malloc/table.c b/lib/malloc/table.c
index e6acbf4a..be6a88d9 100644
--- a/lib/malloc/table.c
+++ b/lib/malloc/table.c
@@ -1,6 +1,6 @@
/* table.c - bookkeeping functions for allocated memory */
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -30,14 +30,14 @@
#ifdef SHELL
extern int running_trap;
-extern int signal_is_trapped PARAMS((int));
+extern int signal_is_trapped (int);
#endif
extern int malloc_register;
#ifdef MALLOC_REGISTER
-extern FILE *_imalloc_fopen PARAMS((char *, char *, char *, char *, size_t));
+extern FILE *_imalloc_fopen (char *, char *, char *, char *, size_t);
#define FIND_ALLOC 0x01 /* find slot for new allocation */
#define FIND_EXIST 0x02 /* find slot for existing entry for free() or search */
@@ -60,8 +60,7 @@ static ma_table_t mlocation_table[REG_TABLE_SIZE];
* NOTE: taken from dmalloc (http://dmalloc.com) and modified.
*/
static unsigned int
-mt_hash (key)
- const PTR_T key;
+mt_hash (const PTR_T key)
{
unsigned int a, b, c;
unsigned long x;
@@ -78,8 +77,7 @@ mt_hash (key)
#if 0
static unsigned int
-which_bucket (mem)
- PTR_T mem;
+which_bucket (PTR_T mem)
{
return (mt_hash ((unsigned char *)mem) & (REG_TABLE_SIZE-1));
}
@@ -95,9 +93,7 @@ which_bucket (mem)
#endif
static mr_table_t *
-find_entry (mem, flags)
- PTR_T mem;
- int flags;
+find_entry (PTR_T mem, int flags)
{
unsigned int bucket;
register mr_table_t *tp;
@@ -135,16 +131,13 @@ find_entry (mem, flags)
}
mr_table_t *
-mr_table_entry (mem)
- PTR_T mem;
+mr_table_entry (PTR_T mem)
{
return (find_entry (mem, FIND_EXIST));
}
void
-mregister_describe_mem (mem, fp)
- PTR_T mem;
- FILE *fp;
+mregister_describe_mem (PTR_T mem, FILE *fp)
{
mr_table_t *entry;
@@ -160,12 +153,7 @@ mregister_describe_mem (mem, fp)
}
void
-mregister_alloc (tag, mem, size, file, line)
- const char *tag;
- PTR_T mem;
- size_t size;
- const char *file;
- int line;
+mregister_alloc (const char *tag, PTR_T mem, size_t size, const char *file, int line)
{
mr_table_t *tentry;
sigset_t set, oset;
@@ -216,11 +204,7 @@ mregister_alloc (tag, mem, size, file, line)
}
void
-mregister_free (mem, size, file, line)
- PTR_T mem;
- int size;
- const char *file;
- int line;
+mregister_free (PTR_T mem, int size, const char *file, int line)
{
mr_table_t *tentry;
sigset_t set, oset;
@@ -268,8 +252,7 @@ mregister_free (mem, size, file, line)
/* If we ever add more flags, this will require changes. */
static char *
-_entry_flags(x)
- int x;
+_entry_flags(int x)
{
if (x & MT_FREE)
return "free";
@@ -280,8 +263,7 @@ _entry_flags(x)
}
static void
-_register_dump_table(fp)
- FILE *fp;
+_register_dump_table(FILE *fp)
{
register int i;
mr_table_t entry;
@@ -303,13 +285,13 @@ _register_dump_table(fp)
}
void
-mregister_dump_table()
+mregister_dump_table(void)
{
_register_dump_table (stderr);
}
void
-mregister_table_init ()
+mregister_table_init (void)
{
memset (mem_table, 0, sizeof(mr_table_t) * REG_TABLE_SIZE);
memset (&mem_overflow, 0, sizeof (mr_table_t));
@@ -319,9 +301,7 @@ mregister_table_init ()
/* Simple for now */
static ma_table_t *
-find_location_entry (file, line)
- const char *file;
- int line;
+find_location_entry (const char *file, int line)
{
register ma_table_t *tp, *endp;
@@ -335,9 +315,7 @@ find_location_entry (file, line)
}
void
-mlocation_register_alloc (file, line)
- const char *file;
- int line;
+mlocation_register_alloc (const char *file, int line)
{
ma_table_t *lentry;
const char *nfile;
@@ -372,8 +350,7 @@ mlocation_register_alloc (file, line)
}
static void
-_location_dump_table (fp)
- FILE *fp;
+_location_dump_table (FILE *fp)
{
register ma_table_t *tp, *endp;
@@ -385,7 +362,7 @@ _location_dump_table (fp)
}
void
-mlocation_dump_table ()
+mlocation_dump_table (void)
{
_location_dump_table (stderr);
}
@@ -393,7 +370,7 @@ mlocation_dump_table ()
#define LOCROOT "/var/tmp/maltrace/locations."
void
-mlocation_write_table ()
+mlocation_write_table (void)
{
FILE *fp;
char defname[sizeof (LOCROOT) + 64];
@@ -406,7 +383,7 @@ mlocation_write_table ()
}
void
-mlocation_table_init ()
+mlocation_table_init (void)
{
memset (mlocation_table, 0, sizeof (ma_table_t) * REG_TABLE_SIZE);
mlocation_table[0].file = ""; /* reserve slot 0 for unknown locations */
@@ -418,8 +395,7 @@ mlocation_table_init ()
#endif /* MALLOC_REGISTER */
int
-malloc_set_register(n)
- int n;
+malloc_set_register (int n)
{
int old;
diff --git a/lib/malloc/table.h b/lib/malloc/table.h
index 92866cf2..e7803762 100644
--- a/lib/malloc/table.h
+++ b/lib/malloc/table.h
@@ -1,6 +1,6 @@
/* table.h - definitions for tables for keeping track of allocated memory */
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -57,12 +57,12 @@ typedef struct mr_table {
#define REG_TABLE_SIZE 8192
-extern mr_table_t *mr_table_entry PARAMS((PTR_T));
-extern void mregister_alloc PARAMS((const char *, PTR_T, size_t, const char *, int));
-extern void mregister_free PARAMS((PTR_T, int, const char *, int));
+extern mr_table_t *mr_table_entry (PTR_T);
+extern void mregister_alloc (const char *, PTR_T, size_t, const char *, int);
+extern void mregister_free (PTR_T, int, const char *, int);
extern void mregister_describe_mem ();
-extern void mregister_dump_table PARAMS((void));
-extern void mregister_table_init PARAMS((void));
+extern void mregister_dump_table (void);
+extern void mregister_table_init (void);
typedef struct ma_table {
const char *file;
@@ -70,10 +70,10 @@ typedef struct ma_table {
int nalloc;
} ma_table_t;
-extern void mlocation_register_alloc PARAMS((const char *, int));
-extern void mlocation_table_init PARAMS((void));
-extern void mlocation_dump_table PARAMS((void));
-extern void mlocation_write_table PARAMS((void));
+extern void mlocation_register_alloc (const char *, int);
+extern void mlocation_table_init (void);
+extern void mlocation_dump_table (void);
+extern void mlocation_write_table (void);
/* NOTE: HASH_MIX taken from dmalloc (http://dmalloc.com) */
diff --git a/lib/malloc/trace.c b/lib/malloc/trace.c
index 391ca9d8..e968e620 100644
--- a/lib/malloc/trace.c
+++ b/lib/malloc/trace.c
@@ -1,6 +1,6 @@
/* trace.c - tracing functions for malloc */
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -35,18 +35,13 @@ static int _mtrace_verbose = 0;
#ifdef MALLOC_TRACE
-extern FILE *_imalloc_fopen PARAMS((char *, char *, char *, char *, size_t));
+extern FILE *_imalloc_fopen (char *, char *, char *, char *, size_t);
FILE *_mtrace_fp = NULL;
extern char _malloc_trace_buckets[];
void
-mtrace_alloc (tag, mem, size, file, line)
- const char *tag;
- PTR_T mem;
- size_t size;
- const char *file;
- int line;
+mtrace_alloc (const char *tag, PTR_T mem, size_t size, const char *file, int line)
{
if (_mtrace_fp == NULL)
_mtrace_fp = stderr;
@@ -60,11 +55,7 @@ mtrace_alloc (tag, mem, size, file, line)
}
void
-mtrace_free (mem, size, file, line)
- PTR_T mem;
- int size;
- const char *file;
- int line;
+mtrace_free (PTR_T mem, int size, const char *file, int line)
{
if (_mtrace_fp == NULL)
_mtrace_fp = stderr;
@@ -79,8 +70,7 @@ mtrace_free (mem, size, file, line)
#endif /* MALLOC_TRACE */
int
-malloc_set_trace (n)
- int n;
+malloc_set_trace (int n)
{
int old;
@@ -91,8 +81,7 @@ malloc_set_trace (n)
}
void
-malloc_set_tracefp (fp)
- FILE *fp;
+malloc_set_tracefp (FILE *fp)
{
#ifdef MALLOC_TRACE
_mtrace_fp = fp ? fp : stderr;
@@ -100,8 +89,7 @@ malloc_set_tracefp (fp)
}
void
-malloc_trace_bin (n)
- int n;
+malloc_trace_bin (int n)
{
#ifdef MALLOC_TRACE
_malloc_trace_buckets[n] = 1;
@@ -111,9 +99,7 @@ malloc_trace_bin (n)
#define TRACEROOT "/var/tmp/maltrace/trace."
void
-malloc_set_tracefn (s, fn)
- char *s;
- char *fn;
+malloc_set_tracefn (char *s, char *fn)
{
#ifdef MALLOC_TRACE
FILE *fp;
diff --git a/lib/malloc/watch.c b/lib/malloc/watch.c
index 00c8a824..681b5593 100644
--- a/lib/malloc/watch.c
+++ b/lib/malloc/watch.c
@@ -1,6 +1,6 @@
/* watch.c - watchpoint functions for malloc */
-/* Copyright (C) 2001-2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -35,11 +35,7 @@ int _malloc_nwatch;
static PTR_T _malloc_watch_list[WATCH_MAX];
static void
-watch_warn (addr, file, line, type, data)
- PTR_T addr;
- const char *file;
- int line, type;
- unsigned long data;
+watch_warn (PTR_T addr, const char *file, int line, int type, unsigned long data)
{
char *tag;
@@ -61,11 +57,7 @@ watch_warn (addr, file, line, type, data)
}
void
-_malloc_ckwatch (addr, file, line, type, data)
- PTR_T addr;
- const char *file;
- int line, type;
- unsigned long data;
+_malloc_ckwatch (PTR_T addr, const char *file, int line, int type, unsigned long data)
{
register int i;
@@ -81,8 +73,7 @@ _malloc_ckwatch (addr, file, line, type, data)
#endif /* MALLOC_WATCH */
PTR_T
-malloc_watch (addr)
- PTR_T addr;
+malloc_watch (PTR_T addr)
{
register int i;
PTR_T ret;
@@ -117,8 +108,7 @@ malloc_watch (addr)
watchpoints. Returns ADDR if everything went OK, NULL if ADDR was
not being watched. */
PTR_T
-malloc_unwatch (addr)
- PTR_T addr;
+malloc_unwatch (PTR_T addr)
{
#ifdef MALLOC_WATCH
register int i;
diff --git a/lib/malloc/watch.h b/lib/malloc/watch.h
index 2a0f4970..81900d3e 100644
--- a/lib/malloc/watch.h
+++ b/lib/malloc/watch.h
@@ -1,6 +1,6 @@
/* watch.h - definitions for tables for keeping track of allocated memory */
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
@@ -34,8 +34,8 @@
extern int _malloc_nwatch;
-extern void _malloc_ckwatch PARAMS((PTR_T, const char *, int, int, unsigned long));
-
+extern void _malloc_ckwatch (PTR_T, const char *, int, int, unsigned long);
+
#endif /* MALLOC_WATCH */
#endif /* _MWATCH_H */
diff --git a/lib/malloc/xmalloc.c b/lib/malloc/xmalloc.c
index f6dec67a..de8f3834 100644
--- a/lib/malloc/xmalloc.c
+++ b/lib/malloc/xmalloc.c
@@ -1,6 +1,6 @@
/* xmalloc.c -- safe versions of malloc and realloc */
-/* Copyright (C) 1991-2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2003, 2022 Free Software Foundation, Inc.
This file is part of GNU Readline, a library for reading lines
of text with interactive input and history editing.
@@ -49,8 +49,7 @@
/* **************************************************************** */
static void
-memory_error_and_abort (fname)
- char *fname;
+memory_error_and_abort (char *fname)
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
@@ -60,8 +59,7 @@ memory_error_and_abort (fname)
to hold BYTES number of bytes. If the memory cannot be allocated,
print an error message and abort. */
PTR_T
-xmalloc (bytes)
- size_t bytes;
+xmalloc (size_t bytes)
{
PTR_T temp;
@@ -72,9 +70,7 @@ xmalloc (bytes)
}
PTR_T
-xrealloc (pointer, bytes)
- PTR_T pointer;
- size_t bytes;
+xrealloc (PTR_T pointer, size_t bytes)
{
PTR_T temp;
@@ -86,8 +82,7 @@ xrealloc (pointer, bytes)
}
void
-xfree (string)
- PTR_T string;
+xfree (PTR_T string)
{
if (string)
free (string);
diff --git a/lib/readline/tcap.h b/lib/readline/tcap.h
index 859e6eed..1121061b 100644
--- a/lib/readline/tcap.h
+++ b/lib/readline/tcap.h
@@ -46,14 +46,14 @@ extern char *UP, *BC;
extern short ospeed;
-extern int tgetent ();
-extern int tgetflag ();
-extern int tgetnum ();
-extern char *tgetstr ();
+extern int tgetent PARAMS((char *, const char *));
+extern int tgetflag PARAMS((const char *));
+extern int tgetnum PARAMS((const char *));
+extern char *tgetstr PARAMS((const char *, char **));
-extern int tputs ();
+extern int tputs PARAMS((const char *, int, int (*)(int));
-extern char *tgoto ();
+extern char *tgoto PARAMS((const char *, int, int));
#endif /* HAVE_TERMCAP_H */
diff --git a/lib/sh/casemod.c b/lib/sh/casemod.c
index 0403f91c..8529db3e 100644
--- a/lib/sh/casemod.c
+++ b/lib/sh/casemod.c
@@ -1,6 +1,6 @@
/* casemod.c -- functions to change case of strings */
-/* Copyright (C) 2008-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -67,7 +67,7 @@
#define CASE_USEWORDS 0x1000 /* modify behavior to act on words in passed string */
-extern char *substring PARAMS((char *, int, int));
+extern char *substring (char *, int, int);
#ifndef UCHAR_MAX
# define UCHAR_MAX TYPE_MAXIMUM(unsigned char)
@@ -75,9 +75,7 @@ extern char *substring PARAMS((char *, int, int));
#if defined (HANDLE_MULTIBYTE)
static wchar_t
-cval (s, i, l)
- char *s;
- int i, l;
+cval (char *s, int i, int l)
{
size_t tmp;
wchar_t wc;
@@ -98,10 +96,7 @@ cval (s, i, l)
/* Modify the case of characters in STRING matching PAT based on the value of
FLAGS. If PAT is null, modify the case of each character */
char *
-sh_modcase (string, pat, flags)
- const char *string;
- char *pat;
- int flags;
+sh_modcase (const char *string, char *pat, int flags)
{
int start, next, end, retind;
int inword, c, nc, nop, match, usewords;
diff --git a/lib/sh/clktck.c b/lib/sh/clktck.c
index 8b9b5b32..654647e8 100644
--- a/lib/sh/clktck.c
+++ b/lib/sh/clktck.c
@@ -1,6 +1,6 @@
/* clktck.c - get the value of CLK_TCK. */
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -44,7 +44,7 @@
#endif /* !HAVE_SYSCONF && !_SC_CLK_TCK */
long
-get_clk_tck ()
+get_clk_tck (void)
{
static long retval = 0;
diff --git a/lib/sh/clock.c b/lib/sh/clock.c
index c6c52bf8..ecc0ffae 100644
--- a/lib/sh/clock.c
+++ b/lib/sh/clock.c
@@ -1,6 +1,6 @@
/* clock.c - operations on struct tms and clock_t's */
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -24,10 +24,7 @@
#include <sys/types.h>
#include <posixtime.h>
-
-#if defined (HAVE_SYS_TIMES_H)
-# include <sys/times.h>
-#endif
+#include <systimes.h>
#include <stdio.h>
#include <stdc.h>
@@ -35,16 +32,13 @@
#include <bashintl.h>
#ifndef locale_decpoint
-extern int locale_decpoint PARAMS((void));
+extern int locale_decpoint (void);
#endif
-extern long get_clk_tck PARAMS((void));
+extern long get_clk_tck (void);
void
-clock_t_to_secs (t, sp, sfp)
- clock_t t;
- time_t *sp;
- int *sfp;
+clock_t_to_secs (clock_t t, time_t *sp, int *sfp)
{
static long clk_tck = -1;
@@ -69,9 +63,7 @@ clock_t_to_secs (t, sp, sfp)
terms of the value of CLK_TCK, which is what is returned by the
`times' call. */
void
-print_clock_t (fp, t)
- FILE *fp;
- clock_t t;
+print_clock_t (FILE *fp, clock_t t)
{
time_t timestamp;
long minutes;
diff --git a/lib/sh/dprintf.c b/lib/sh/dprintf.c
index b3b5d644..9d95834c 100644
--- a/lib/sh/dprintf.c
+++ b/lib/sh/dprintf.c
@@ -1,6 +1,6 @@
/* dprintf -- printf to a file descriptor */
-/* Copyright (C) 2008-2010 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2010,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -37,14 +37,7 @@
#include <stdio.h>
int
-#if defined (PREFER_STDARG)
dprintf(int fd, const char *format, ...)
-#else
-dprintf(fd, format, va_alist)
- int fd;
- const char *format;
- va_dcl
-#endif
{
FILE *fp;
int fd2, rc, r2;
diff --git a/lib/sh/eaccess.c b/lib/sh/eaccess.c
index c3043ec1..00aadb21 100644
--- a/lib/sh/eaccess.c
+++ b/lib/sh/eaccess.c
@@ -1,6 +1,6 @@
/* eaccess.c - eaccess replacement for the shell, plus other access functions. */
-/* Copyright (C) 2006-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -52,15 +52,14 @@ extern int errno;
#define F_OK 0
#endif /* R_OK */
-static int path_is_devfd PARAMS((const char *));
-static int sh_stataccess PARAMS((const char *, int));
+static int path_is_devfd (const char *);
+static int sh_stataccess (const char *, int);
#if HAVE_DECL_SETREGID
-static int sh_euidaccess PARAMS((const char *, int));
+static int sh_euidaccess (const char *, int);
#endif
static int
-path_is_devfd (path)
- const char *path;
+path_is_devfd (const char *path)
{
if (path[0] == '/' && path[1] == 'd' && strncmp (path, "/dev/fd/", 8) == 0)
return 1;
@@ -78,9 +77,7 @@ path_is_devfd (path)
/* A wrapper for stat () which disallows pathnames that are empty strings
and handles /dev/fd emulation on systems that don't have it. */
int
-sh_stat (path, finfo)
- const char *path;
- struct stat *finfo;
+sh_stat (const char *path, struct stat *finfo)
{
static char *pbuf = 0;
@@ -136,9 +133,7 @@ sh_stat (path, finfo)
and don't make the mistake of telling root that any file is
executable. This version uses stat(2). */
static int
-sh_stataccess (path, mode)
- const char *path;
- int mode;
+sh_stataccess (const char *path, int mode)
{
struct stat st;
@@ -173,9 +168,7 @@ sh_stataccess (path, mode)
/* Version to call when uid != euid or gid != egid. We temporarily swap
the effective and real uid and gid as appropriate. */
static int
-sh_euidaccess (path, mode)
- const char *path;
- int mode;
+sh_euidaccess (const char *path, int mode)
{
int r, e;
@@ -198,9 +191,7 @@ sh_euidaccess (path, mode)
#endif
int
-sh_eaccess (path, mode)
- const char *path;
- int mode;
+sh_eaccess (const char *path, int mode)
{
int ret;
diff --git a/lib/sh/fmtulong.c b/lib/sh/fmtulong.c
index 0ccc22b4..b85fab31 100644
--- a/lib/sh/fmtulong.c
+++ b/lib/sh/fmtulong.c
@@ -81,12 +81,7 @@ extern int errno;
base. The caller passes the output buffer and the size. This should
check for buffer underflow, but currently does not. */
char *
-fmtulong (ui, base, buf, len, flags)
- UNSIGNED_LONG ui;
- int base;
- char *buf;
- size_t len;
- int flags;
+fmtulong (UNSIGNED_LONG ui, int base, char *buf, size_t len, int flags)
{
char *p;
int sign;
diff --git a/lib/sh/fnxform.c b/lib/sh/fnxform.c
index 35d7e737..53db5d68 100644
--- a/lib/sh/fnxform.c
+++ b/lib/sh/fnxform.c
@@ -1,6 +1,6 @@
/* fnxform - use iconv(3) to transform strings to and from "filename" format */
-/* Copyright (C) 2009-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -35,9 +35,9 @@
#endif
#if defined (HAVE_LOCALE_CHARSET)
-extern const char *locale_charset PARAMS((void));
+extern const char *locale_charset (void);
#else
-extern char *get_locale_var PARAMS((char *));
+extern char *get_locale_var (char *);
#endif
#if defined (HAVE_ICONV)
@@ -49,12 +49,12 @@ static iconv_t conv_tofs = (iconv_t)-1;
static char *outbuf = 0;
static size_t outlen = 0;
-static char *curencoding PARAMS((void));
-static void init_tofs PARAMS((void));
-static void init_fromfs PARAMS((void));
+static char *curencoding (void);
+static void init_tofs (void);
+static void init_fromfs (void);
static char *
-curencoding ()
+curencoding (void)
{
char *loc;
#if defined (HAVE_LOCALE_CHARSET)
@@ -77,7 +77,7 @@ curencoding ()
}
static void
-init_tofs ()
+init_tofs (void)
{
char *cur;
@@ -86,7 +86,7 @@ init_tofs ()
}
static void
-init_fromfs ()
+init_fromfs (void)
{
char *cur;
@@ -95,9 +95,7 @@ init_fromfs ()
}
char *
-fnx_tofs (string, len)
- char *string;
- size_t len;
+fnx_tofs (char *string, size_t len)
{
#ifdef MACOSX
ICONV_CONST char *inbuf;
@@ -139,9 +137,7 @@ fnx_tofs (string, len)
}
char *
-fnx_fromfs (string, len)
- char *string;
- size_t len;
+fnx_fromfs (char *string, size_t len)
{
#ifdef MACOSX
ICONV_CONST char *inbuf;
@@ -184,15 +180,13 @@ fnx_fromfs (string, len)
#else
char *
-fnx_tofs (string)
- char *string;
+fnx_tofs (char *string, size_t len)
{
return string;
}
char *
-fnx_fromfs (string)
- char *string;
+fnx_fromfs (char *string, size_t len)
{
return string;
}
diff --git a/lib/sh/fpurge.c b/lib/sh/fpurge.c
index 8cd4e368..4547b838 100644
--- a/lib/sh/fpurge.c
+++ b/lib/sh/fpurge.c
@@ -1,6 +1,6 @@
/* fpurge - Flushing buffers of a FILE stream. */
-/* Copyright (C) 2007-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -29,7 +29,7 @@
#if HAVE_FPURGE
# define fpurge _bash_fpurge
#endif
-extern int fpurge PARAMS((FILE *stream));
+extern int fpurge (FILE *stream);
#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */
# include <stdio_ext.h>
diff --git a/lib/sh/getcwd.c b/lib/sh/getcwd.c
index d7bd241b..e45ccb00 100644
--- a/lib/sh/getcwd.c
+++ b/lib/sh/getcwd.c
@@ -1,6 +1,6 @@
/* getcwd.c -- get pathname of current directory */
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -73,10 +73,7 @@ extern int errno;
the inode corresponding to PATH/DIR is identical to THISINO. */
#if !defined (D_FILENO_AVAILABLE)
static int
-_path_checkino (dotp, name, thisino)
- char *dotp;
- char *name;
- ino_t thisino;
+_path_checkino (char *dotp, char *name, ino_t thisino)
{
char *fullpath;
int r, e;
@@ -102,15 +99,8 @@ _path_checkino (dotp, name, thisino)
an array is allocated with `malloc'; the array is SIZE
bytes long, unless SIZE <= 0, in which case it is as
big as necessary. */
-#if defined (__STDC__)
char *
getcwd (char *buf, size_t size)
-#else /* !__STDC__ */
-char *
-getcwd (buf, size)
- char *buf;
- size_t size;
-#endif /* !__STDC__ */
{
static const char dots[]
= "../../../../../../../../../../../../../../../../../../../../../../../\
diff --git a/lib/sh/getenv.c b/lib/sh/getenv.c
index 1e682aef..8f4510ae 100644
--- a/lib/sh/getenv.c
+++ b/lib/sh/getenv.c
@@ -47,8 +47,7 @@ extern char **environ;
static char *last_tempenv_value = (char *)NULL;
char *
-getenv (name)
- const char *name;
+getenv (const char *name)
{
SHELL_VAR *var;
@@ -90,20 +89,14 @@ getenv (name)
/* Some versions of Unix use _getenv instead. */
char *
-_getenv (name)
- const char *name;
+_getenv (const char *name)
{
return (getenv (name));
}
/* SUSv3 says argument is a `char *'; BSD implementations disagree */
int
-putenv (str)
-#ifndef HAVE_STD_PUTENV
- const char *str;
-#else
- char *str;
-#endif
+putenv (char *str)
{
SHELL_VAR *var;
char *name, *value;
@@ -142,22 +135,14 @@ putenv (str)
#if 0
int
-_putenv (name)
-#ifndef HAVE_STD_PUTENV
- const char *name;
-#else
- char *name;
-#endif
+_putenv (char *name)
{
return putenv (name);
}
#endif
int
-setenv (name, value, rewrite)
- const char *name;
- const char *value;
- int rewrite;
+setenv (const char *name, const char *value, int rewrite)
{
SHELL_VAR *var;
char *v;
@@ -188,33 +173,22 @@ setenv (name, value, rewrite)
#if 0
int
-_setenv (name, value, rewrite)
- const char *name;
- const char *value;
- int rewrite;
+_setenv (const char *name, const char *value, int rewrite)
{
return setenv (name, value, rewrite);
}
#endif
-/* SUSv3 says unsetenv returns int; existing implementations (BSD) disagree. */
+/* SUSv3 says unsetenv returns int; existing implementations (BSD) disagree.
+ POSIX says int. */
-#ifdef HAVE_STD_UNSETENV
-#define UNSETENV_RETURN(N) return(N)
-#define UNSETENV_RETTYPE int
-#else
-#define UNSETENV_RETURN(N) return
-#define UNSETENV_RETTYPE void
-#endif
-
-UNSETENV_RETTYPE
-unsetenv (name)
- const char *name;
+int
+unsetenv (const char *name)
{
if (name == 0 || *name == '\0' || strchr (name, '=') != 0)
{
errno = EINVAL;
- UNSETENV_RETURN(-1);
+ return (-1);
}
/* XXX - should we just remove the export attribute here? */
@@ -228,6 +202,6 @@ unsetenv (name)
VUNSETATTR (v, att_exported);
#endif
- UNSETENV_RETURN(0);
+ return (0);
}
#endif /* CAN_REDEFINE_GETENV */
diff --git a/lib/sh/gettimeofday.c b/lib/sh/gettimeofday.c
index eaec25cc..1b78dcb2 100644
--- a/lib/sh/gettimeofday.c
+++ b/lib/sh/gettimeofday.c
@@ -1,6 +1,6 @@
/* gettimeofday.c - gettimeofday replacement using time() */
-/* Copyright (C) 2020 Free Software Foundation, Inc.
+/* Copyright (C) 2020, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
diff --git a/lib/sh/inet_aton.c b/lib/sh/inet_aton.c
index e377178e..4900a62d 100644
--- a/lib/sh/inet_aton.c
+++ b/lib/sh/inet_aton.c
@@ -94,8 +94,7 @@ static char rcsid[] = "$Id: inet_addr.c,v 1.5 1996/08/14 03:48:37 drepper Exp $"
* The value returned is in network order.
*/
u_long
-inet_addr(cp)
- register const char *cp;
+inet_addr(register const char *cp)
{
struct in_addr val;
@@ -113,9 +112,7 @@ inet_addr(cp)
* cannot distinguish between failure and a local broadcast address.
*/
int
-inet_aton(cp, addr)
- register const char *cp;
- struct in_addr *addr;
+inet_aton(register const char *cp, struct in_addr *addr)
{
register u_bits32_t val;
register int base, n;
diff --git a/lib/sh/input_avail.c b/lib/sh/input_avail.c
index 262bc749..9925bd3c 100644
--- a/lib/sh/input_avail.c
+++ b/lib/sh/input_avail.c
@@ -61,8 +61,7 @@ extern int errno;
/* Return >= 1 if select/FIONREAD indicates data available for reading on
file descriptor FD; 0 if no data available. Return -1 on error. */
int
-input_avail (fd)
- int fd;
+input_avail (int fd)
{
int result, chars_avail;
#if defined(HAVE_SELECT)
@@ -100,9 +99,7 @@ input_avail (fd)
/* Wait until NCHARS are available for reading on file descriptor FD.
This can wait indefinitely. Return -1 on error. */
int
-nchars_avail (fd, nchars)
- int fd;
- int nchars;
+nchars_avail (int fd, int nchars)
{
int result, chars_avail;
#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
diff --git a/lib/sh/itos.c b/lib/sh/itos.c
index cd36ef33..4b137b50 100644
--- a/lib/sh/itos.c
+++ b/lib/sh/itos.c
@@ -30,10 +30,7 @@
#include "shell.h"
char *
-inttostr (i, buf, len)
- intmax_t i;
- char *buf;
- size_t len;
+inttostr (intmax_t i, char *buf, size_t len)
{
return (fmtumax (i, 10, buf, len, 0));
}
@@ -41,8 +38,7 @@ inttostr (i, buf, len)
/* Integer to string conversion. This conses the string; the
caller should free it. */
char *
-itos (i)
- intmax_t i;
+itos (intmax_t i)
{
char *p, lbuf[INT_STRLEN_BOUND(intmax_t) + 1];
@@ -53,8 +49,7 @@ itos (i)
/* Integer to string conversion. This conses the string using strdup;
caller should free it and be prepared to deal with NULL return. */
char *
-mitos (i)
- intmax_t i;
+mitos (intmax_t i)
{
char *p, lbuf[INT_STRLEN_BOUND(intmax_t) + 1];
@@ -63,10 +58,7 @@ mitos (i)
}
char *
-uinttostr (i, buf, len)
- uintmax_t i;
- char *buf;
- size_t len;
+uinttostr (uintmax_t i, char *buf, size_t len)
{
return (fmtumax (i, 10, buf, len, FL_UNSIGNED));
}
@@ -74,8 +66,7 @@ uinttostr (i, buf, len)
/* Integer to string conversion. This conses the string; the
caller should free it. */
char *
-uitos (i)
- uintmax_t i;
+uitos (uintmax_t i)
{
char *p, lbuf[INT_STRLEN_BOUND(uintmax_t) + 1];
diff --git a/lib/sh/mailstat.c b/lib/sh/mailstat.c
index bd5c25fb..1ec646aa 100644
--- a/lib/sh/mailstat.c
+++ b/lib/sh/mailstat.c
@@ -1,6 +1,6 @@
/* mailstat.c -- stat a mailbox file, handling maildir-type mail directories */
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -52,9 +52,7 @@
*/
int
-mailstat(path, st)
- const char *path;
- struct stat *st;
+mailstat(const char *path, struct stat *st)
{
static struct stat st_new_last, st_ret_last;
struct stat st_ret, st_tmp;
diff --git a/lib/sh/makepath.c b/lib/sh/makepath.c
index ab46c967..448554a8 100644
--- a/lib/sh/makepath.c
+++ b/lib/sh/makepath.c
@@ -1,6 +1,6 @@
/* makepath.c - glue PATH and DIR together into a full pathname. */
-/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -45,7 +45,7 @@
# define MP_IGNDOT 0x08
#endif
-extern char *get_working_directory PARAMS((char *));
+extern char *get_working_directory (char *);
static char *nullpath = "";
@@ -67,9 +67,7 @@ static char *nullpath = "";
} while (0)
char *
-sh_makepath (path, dir, flags)
- const char *path, *dir;
- int flags;
+sh_makepath (const char *path, const char *dir, int flags)
{
int dirlen, pathlen;
char *ret, *xpath, *xdir, *r, *s;
diff --git a/lib/sh/mbscasecmp.c b/lib/sh/mbscasecmp.c
index bb94f183..9aa6a2ff 100644
--- a/lib/sh/mbscasecmp.c
+++ b/lib/sh/mbscasecmp.c
@@ -31,9 +31,7 @@
/* Compare MBS1 and MBS2 without regard to case. */
int
-mbscasecmp (mbs1, mbs2)
- const char *mbs1;
- const char *mbs2;
+mbscasecmp (const char *mbs1, const char *mbs2)
{
int len1, len2, mb_cur_max;
wchar_t c1, c2, l1, l2;
diff --git a/lib/sh/mbschr.c b/lib/sh/mbschr.c
index 639962d4..f86ea0bb 100644
--- a/lib/sh/mbschr.c
+++ b/lib/sh/mbschr.c
@@ -39,13 +39,7 @@ extern char *utf8_mbschr (const char *, int); /* XXX */
legacy strchr() might return the wrong value. */
char *
-#if defined (PROTOTYPES)
mbschr (const char *s, int c)
-#else
-mbschr (s, c)
- const char *s;
- int c;
-#endif
{
#if HANDLE_MULTIBYTE
char *pos;
diff --git a/lib/sh/mbscmp.c b/lib/sh/mbscmp.c
index f475c538..a8d4bfd1 100644
--- a/lib/sh/mbscmp.c
+++ b/lib/sh/mbscmp.c
@@ -32,9 +32,7 @@ extern int utf8_mbscmp (const char *, const char *);
/* Compare MBS1 and MBS2. */
int
-mbscmp (mbs1, mbs2)
- const char *mbs1;
- const char *mbs2;
+mbscmp (const char *mbs1, const char *mbs2)
{
int len1, len2, mb_cur_max;
wchar_t c1, c2;
diff --git a/lib/sh/mktime.c b/lib/sh/mktime.c
index 9ee675be..810b701d 100644
--- a/lib/sh/mktime.c
+++ b/lib/sh/mktime.c
@@ -1,6 +1,6 @@
/* mktime - convert struct tm to a time_t value */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Contributed by Paul Eggert (eggert@twinsun.com).
@@ -56,14 +56,6 @@
#define mktime my_mktime
#endif /* DEBUG_MKTIME */
-#ifndef PARAMS
-#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-#define PARAMS(args) args
-#else
-#define PARAMS(args) ()
-#endif /* GCC. */
-#endif /* Not PARAMS. */
-
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
@@ -117,17 +109,15 @@ const unsigned short int __mon_yday[2][13] =
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
};
-static time_t ydhms_tm_diff PARAMS ((int, int, int, int, int, const struct tm *));
-time_t __mktime_internal PARAMS ((struct tm *,
+static time_t ydhms_tm_diff (int, int, int, int, int, const struct tm *);
+time_t __mktime_internal (struct tm *,
struct tm *(*) (const time_t *, struct tm *),
- time_t *));
+ time_t *);
-static struct tm *my_localtime_r PARAMS ((const time_t *, struct tm *));
+static struct tm *my_localtime_r (const time_t *, struct tm *);
static struct tm *
-my_localtime_r (t, tp)
- const time_t *t;
- struct tm *tp;
+my_localtime_r (const time_t *t, struct tm *tp)
{
struct tm *l = localtime (t);
if (! l)
@@ -136,16 +126,13 @@ my_localtime_r (t, tp)
return tp;
}
-
/* Yield the difference between (YEAR-YDAY HOUR:MIN:SEC) and (*TP),
measured in seconds, ignoring leap seconds.
YEAR uses the same numbering as TM->tm_year.
All values are in range, except possibly YEAR.
If overflow occurs, yield the low order bits of the correct answer. */
static time_t
-ydhms_tm_diff (year, yday, hour, min, sec, tp)
- int year, yday, hour, min, sec;
- const struct tm *tp;
+ydhms_tm_diff (int year, int yday, int hour, int min, int sec, const struct tm *tp)
{
/* Compute intervening leap days correctly even if year is negative.
Take care to avoid int overflow. time_t overflow is OK, since
@@ -167,13 +154,11 @@ ydhms_tm_diff (year, yday, hour, min, sec, tp)
+ (sec - tp->tm_sec));
}
-
static time_t localtime_offset;
/* Convert *TP to a time_t value. */
time_t
-mktime (tp)
- struct tm *tp;
+mktime (struct tm *tp)
{
#ifdef _LIBC
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
@@ -191,10 +176,9 @@ mktime (tp)
compared to what the result would be for UTC without leap seconds.
If *OFFSET's guess is correct, only one CONVERT call is needed. */
time_t
-__mktime_internal (tp, convert, offset)
- struct tm *tp;
- struct tm *(*convert) PARAMS ((const time_t *, struct tm *));
- time_t *offset;
+__mktime_internal (struct tm *tp,
+ struct tm *(*convert) (const time_t *, struct tm *),
+ time_t *offset)
{
time_t t, dt, t0;
struct tm tm;
@@ -317,122 +301,3 @@ __mktime_internal (tp, convert, offset)
#ifdef weak_alias
weak_alias (mktime, timelocal)
#endif
-
-#if DEBUG_MKTIME
-
-static int
-not_equal_tm (a, b)
- struct tm *a;
- struct tm *b;
-{
- return ((a->tm_sec ^ b->tm_sec)
- | (a->tm_min ^ b->tm_min)
- | (a->tm_hour ^ b->tm_hour)
- | (a->tm_mday ^ b->tm_mday)
- | (a->tm_mon ^ b->tm_mon)
- | (a->tm_year ^ b->tm_year)
- | (a->tm_mday ^ b->tm_mday)
- | (a->tm_yday ^ b->tm_yday)
- | (a->tm_isdst ^ b->tm_isdst));
-}
-
-static void
-print_tm (tp)
- struct tm *tp;
-{
- printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
- tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
- tp->tm_hour, tp->tm_min, tp->tm_sec,
- tp->tm_yday, tp->tm_wday, tp->tm_isdst);
-}
-
-static int
-check_result (tk, tmk, tl, tml)
- time_t tk;
- struct tm tmk;
- time_t tl;
- struct tm tml;
-{
- if (tk != tl || not_equal_tm (&tmk, &tml))
- {
- printf ("mktime (");
- print_tm (&tmk);
- printf (")\nyields (");
- print_tm (&tml);
- printf (") == %ld, should be %ld\n", (long) tl, (long) tk);
- return 1;
- }
-
- return 0;
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int status = 0;
- struct tm tm, tmk, tml;
- time_t tk, tl;
- char trailer;
-
- if ((argc == 3 || argc == 4)
- && (sscanf (argv[1], "%d-%d-%d%c",
- &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
- == 3)
- && (sscanf (argv[2], "%d:%d:%d%c",
- &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
- == 3))
- {
- tm.tm_year -= TM_YEAR_BASE;
- tm.tm_mon--;
- tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]);
- tmk = tm;
- tl = mktime (&tmk);
- tml = *localtime (&tl);
- printf ("mktime returns %ld == ", (long) tl);
- print_tm (&tmk);
- printf ("\n");
- status = check_result (tl, tmk, tl, tml);
- }
- else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0))
- {
- time_t from = atol (argv[1]);
- time_t by = atol (argv[2]);
- time_t to = atol (argv[3]);
-
- if (argc == 4)
- for (tl = from; tl <= to; tl += by)
- {
- tml = *localtime (&tl);
- tmk = tml;
- tk = mktime (&tmk);
- status |= check_result (tk, tmk, tl, tml);
- }
- else
- for (tl = from; tl <= to; tl += by)
- {
- /* Null benchmark. */
- tml = *localtime (&tl);
- tmk = tml;
- tk = tl;
- status |= check_result (tk, tmk, tl, tml);
- }
- }
- else
- printf ("Usage:\
-\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
-\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
-\t%s FROM BY TO - # Do not test those values (for benchmark).\n",
- argv[0], argv[0], argv[0]);
-
- return status;
-}
-
-#endif /* DEBUG_MKTIME */
-
-/*
-Local Variables:
-compile-command: "gcc -DDEBUG=1 -Wall -O -g mktime.c -o mktime"
-End:
-*/
diff --git a/lib/sh/netconn.c b/lib/sh/netconn.c
index e20f1042..08903acd 100644
--- a/lib/sh/netconn.c
+++ b/lib/sh/netconn.c
@@ -1,6 +1,6 @@
/* netconn.c -- is a particular file descriptor a network connection?. */
-/* Copyright (C) 2002-2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2005,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -41,8 +41,7 @@
/* Is FD a socket or network connection? */
int
-isnetconn (fd)
- int fd;
+isnetconn (int fd)
{
#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && !defined (SVR4_2) && !defined (__BEOS__)
int rv;
diff --git a/lib/sh/netopen.c b/lib/sh/netopen.c
index ee0baf66..23901b7f 100644
--- a/lib/sh/netopen.c
+++ b/lib/sh/netopen.c
@@ -5,7 +5,7 @@
* chet@ins.CWRU.Edu
*/
-/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -63,27 +63,25 @@ extern int errno;
#endif
#if !defined (HAVE_INET_ATON)
-extern int inet_aton PARAMS((const char *, struct in_addr *));
+extern int inet_aton (const char *, struct in_addr *);
#endif
#ifndef HAVE_GETADDRINFO
-static int _getaddr PARAMS((char *, struct in_addr *));
-static int _getserv PARAMS((char *, int, unsigned short *));
-static int _netopen4 PARAMS((char *, char *, int));
+static int _getaddr (char *, struct in_addr *);
+static int _getserv (char *, int, unsigned short *);
+static int _netopen4 (char *, char *, int);
#else /* HAVE_GETADDRINFO */
-static int _netopen6 PARAMS((char *, char *, int));
+static int _netopen6 (char *, char *, int);
#endif
-static int _netopen PARAMS((char *, char *, int));
+static int _netopen (char *, char *, int);
#ifndef HAVE_GETADDRINFO
/* Stuff the internet address corresponding to HOST into AP, in network
byte order. Return 1 on success, 0 on failure. */
static int
-_getaddr (host, ap)
- char *host;
- struct in_addr *ap;
+_getaddr (char *host, struct in_addr *ap)
{
struct hostent *h;
int r;
@@ -114,10 +112,7 @@ _getaddr (host, ap)
/* Return 1 if SERV is a valid port number and stuff the converted value into
PP in network byte order. */
static int
-_getserv (serv, proto, pp)
- char *serv;
- int proto;
- unsigned short *pp;
+_getserv (char *serv, int proto, unsigned short *pp)
{
intmax_t l;
unsigned short s;
@@ -154,9 +149,7 @@ _getserv (serv, proto, pp)
* traditional BSD mechanisms. Returns the connected socket or -1 on error.
*/
static int
-_netopen4(host, serv, typ)
- char *host, *serv;
- int typ;
+_netopen4(char *host, char *serv, int typ)
{
struct in_addr ina;
struct sockaddr_in sin;
@@ -209,9 +202,7 @@ _netopen4(host, serv, typ)
* on error.
*/
static int
-_netopen6 (host, serv, typ)
- char *host, *serv;
- int typ;
+_netopen6 (char *host, char *serv, int typ)
{
int s, e;
struct addrinfo hints, *res, *res0;
@@ -274,9 +265,7 @@ _netopen6 (host, serv, typ)
* Returns the connected socket or -1 on error.
*/
static int
-_netopen(host, serv, typ)
- char *host, *serv;
- int typ;
+_netopen(char *host, char *serv, int typ)
{
#ifdef HAVE_GETADDRINFO
return (_netopen6 (host, serv, typ));
@@ -290,8 +279,7 @@ _netopen(host, serv, typ)
* host `host' on port `port' and return the connected socket.
*/
int
-netopen (path)
- char *path;
+netopen (char *path)
{
char *np, *s, *t;
int fd;
@@ -320,8 +308,7 @@ netopen (path)
* `serv' and return the connected socket.
*/
int
-tcpopen (host, serv)
- char *host, *serv;
+tcpopen (char *host, char *serv)
{
return (_netopen (host, serv, 't'));
}
@@ -331,8 +318,7 @@ tcpopen (host, serv)
* `serv' and return the connected socket.
*/
int
-udpopen (host, serv)
- char *host, *serv;
+udpopen (char *host, char *serv)
{
return _netopen (host, serv, 'u');
}
@@ -341,8 +327,7 @@ udpopen (host, serv)
#else /* !HAVE_NETWORK */
int
-netopen (path)
- char *path;
+netopen (char *path)
{
internal_error (_("network operations not supported"));
return -1;
diff --git a/lib/sh/oslib.c b/lib/sh/oslib.c
index edc5c6f2..b9919c71 100644
--- a/lib/sh/oslib.c
+++ b/lib/sh/oslib.c
@@ -1,6 +1,6 @@
/* oslib.c - functions present only in some unix versions. */
-/* Copyright (C) 1995,2010 Free Software Foundation, Inc.
+/* Copyright (C) 1995,2010,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -54,9 +54,7 @@ extern int errno;
/* Make the functions strchr and strrchr if they do not exist. */
#if !defined (HAVE_STRCHR)
char *
-strchr (string, c)
- char *string;
- int c;
+strchr (const char *string, int c)
{
register char *s;
@@ -68,9 +66,7 @@ strchr (string, c)
}
char *
-strrchr (string, c)
- char *string;
- int c;
+strrchr (const char *string, int c)
{
register char *s, *t;
@@ -85,8 +81,7 @@ strrchr (string, c)
/* Replacement for dup2 (), for those systems which either don't have it,
or supply one with broken behaviour. */
int
-dup2 (fd1, fd2)
- int fd1, fd2;
+dup2 (int fd1, int fd2)
{
int saved_errno, r;
@@ -143,7 +138,7 @@ dup2 (fd1, fd2)
#if !defined (HAVE_GETDTABLESIZE)
int
-getdtablesize ()
+getdtablesize (void)
{
# if defined (_POSIX_VERSION) && defined (HAVE_SYSCONF) && defined (_SC_OPEN_MAX)
return (sysconf(_SC_OPEN_MAX)); /* Posix systems use sysconf */
@@ -166,9 +161,7 @@ getdtablesize ()
# undef bcopy
# endif
void
-bcopy (s,d,n)
- void *d, *s;
- size_t n;
+bcopy (void *s, *d, size_t n)
{
FASTCOPY (s, d, n);
}
@@ -179,9 +172,7 @@ bcopy (s,d,n)
# undef bzero
# endif
void
-bzero (s, n)
- void *s;
- size_t n;
+bzero (void *s, size_t n)
{
register int i;
register char *r;
@@ -195,9 +186,7 @@ bzero (s, n)
# if defined (HAVE_UNAME)
# include <sys/utsname.h>
int
-gethostname (name, namelen)
- char *name;
- size_t namelen;
+gethostname (char *name, size_t namelen)
{
int i;
struct utsname ut;
@@ -212,9 +201,7 @@ gethostname (name, namelen)
}
# else /* !HAVE_UNAME */
int
-gethostname (name, namelen)
- char *name;
- size_t namelen;
+gethostname (char *name, size_t namelen)
{
strncpy (name, "unknown", namelen);
name[namelen] = '\0';
@@ -225,9 +212,7 @@ gethostname (name, namelen)
#if !defined (HAVE_KILLPG)
int
-killpg (pgrp, sig)
- pid_t pgrp;
- int sig;
+killpg (pid_t pgrp, int sig)
{
return (kill (-pgrp, sig));
}
@@ -235,9 +220,7 @@ killpg (pgrp, sig)
#if !defined (HAVE_MKFIFO) && defined (PROCESS_SUBSTITUTION)
int
-mkfifo (path, mode)
- char *path;
- mode_t mode;
+mkfifo (char *path, mode_t mode)
{
#if defined (S_IFIFO)
return (mknod (path, (mode | S_IFIFO), 0));
@@ -250,7 +233,7 @@ mkfifo (path, mode)
#define DEFAULT_MAXGROUPS 64
int
-getmaxgroups ()
+getmaxgroups (void)
{
static int maxgroups = -1;
@@ -278,7 +261,7 @@ getmaxgroups ()
}
long
-getmaxchild ()
+getmaxchild (void)
{
static long maxchild = -1L;
diff --git a/lib/sh/pathcanon.c b/lib/sh/pathcanon.c
index 7d0df9f9..2820e310 100644
--- a/lib/sh/pathcanon.c
+++ b/lib/sh/pathcanon.c
@@ -1,6 +1,6 @@
/* pathcanon.c -- canonicalize and manipulate pathnames. */
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -45,9 +45,8 @@ extern int errno;
#if defined (__CYGWIN__)
#include <sys/cygwin.h>
-static int
-_is_cygdrive (path)
- char *path;
+static inline int
+_is_cygdrive (char *path)
{
static char user[MAXPATHLEN];
static char system[MAXPATHLEN];
@@ -72,8 +71,7 @@ _is_cygdrive (path)
/* Return 1 if PATH corresponds to a directory. A function for debugging. */
static int
-_path_isdir (path)
- char *path;
+_path_isdir (char *path)
{
int l;
struct stat sb;
@@ -101,9 +99,7 @@ _path_isdir (path)
#define DOUBLE_SLASH(p) ((p[0] == '/') && (p[1] == '/') && p[2] != '/')
char *
-sh_canonpath (path, flags)
- char *path;
- int flags;
+sh_canonpath (char *path, int flags)
{
char stub_char;
char *result, *p, *q, *base, *dotdot;
diff --git a/lib/sh/pathphys.c b/lib/sh/pathphys.c
index 95b72f19..b0ffdb99 100644
--- a/lib/sh/pathphys.c
+++ b/lib/sh/pathphys.c
@@ -1,6 +1,6 @@
/* pathphys.c -- return pathname with all symlinks expanded. */
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -46,13 +46,10 @@
extern int errno;
#endif /* !errno */
-extern char *get_working_directory PARAMS((char *));
+extern char *get_working_directory (char *);
-static int
-_path_readlink (path, buf, bufsiz)
- char *path;
- char *buf;
- int bufsiz;
+static inline int
+_path_readlink (char *path, char *buf, int bufsiz)
{
#ifdef HAVE_READLINK
return readlink (path, buf, bufsiz);
@@ -72,9 +69,7 @@ _path_readlink (path, buf, bufsiz)
*/
char *
-sh_physpath (path, flags)
- char *path;
- int flags;
+sh_physpath (char *path, int flags)
{
char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1];
char *result, *p, *q, *qsave, *qbase, *workpath;
@@ -252,9 +247,7 @@ error:
}
char *
-sh_realpath (pathname, resolved)
- const char *pathname;
- char *resolved;
+sh_realpath (const char *pathname, char *resolved)
{
char *tdir, *wd;
diff --git a/lib/sh/random.c b/lib/sh/random.c
index 1eaa71aa..d1b3df28 100644
--- a/lib/sh/random.c
+++ b/lib/sh/random.c
@@ -1,6 +1,6 @@
/* random.c -- Functions for managing 16-bit and 32-bit random numbers. */
-/* Copyright (C) 2020 Free Software Foundation, Inc.
+/* Copyright (C) 2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -40,20 +40,19 @@ extern time_t shell_start_time;
extern int last_random_value;
-static u_bits32_t intrand32 PARAMS((u_bits32_t));
-static u_bits32_t genseed PARAMS((void));
+static u_bits32_t intrand32 (u_bits32_t);
+static u_bits32_t genseed (void);
-static u_bits32_t brand32 PARAMS((void));
-static void sbrand32 PARAMS((u_bits32_t));
-static void perturb_rand32 PARAMS((void));
+static u_bits32_t brand32 (void);
+static void sbrand32 (u_bits32_t);
+static void perturb_rand32 (void);
/* The random number seed. You can change this by setting RANDOM. */
static u_bits32_t rseed = 1;
/* Returns a 32-bit pseudo-random number. */
static u_bits32_t
-intrand32 (last)
- u_bits32_t last;
+intrand32 (u_bits32_t last)
{
/* Minimal Standard generator from
"Random number generators: good ones are hard to find",
@@ -84,7 +83,7 @@ intrand32 (last)
}
static u_bits32_t
-genseed ()
+genseed (void)
{
struct timeval tv;
u_bits32_t iv;
@@ -99,7 +98,7 @@ genseed ()
/* Returns a pseudo-random number between 0 and 32767. */
int
-brand ()
+brand (void)
{
unsigned int ret;
@@ -113,15 +112,14 @@ brand ()
/* Set the random number generator seed to SEED. */
void
-sbrand (seed)
- unsigned long seed;
+sbrand (unsigned long seed)
{
rseed = seed;
last_random_value = 0;
}
void
-seedrand ()
+seedrand (void)
{
u_bits32_t iv;
@@ -138,7 +136,7 @@ static int urandfd = -1;
/* Returns a 32-bit pseudo-random number between 0 and 4294967295. */
static u_bits32_t
-brand32 ()
+brand32 (void)
{
u_bits32_t ret;
@@ -147,14 +145,13 @@ brand32 ()
}
static void
-sbrand32 (seed)
- u_bits32_t seed;
+sbrand32 (u_bits32_t seed)
{
last_rand32 = rseed32 = seed;
}
void
-seedrand32 ()
+seedrand32 (void)
{
u_bits32_t iv;
@@ -163,14 +160,14 @@ seedrand32 ()
}
static void
-perturb_rand32 ()
+perturb_rand32 (void)
{
rseed32 ^= genseed ();
}
/* Force another attempt to open /dev/urandom on the next call to get_urandom32 */
void
-urandom_close ()
+urandom_close (void)
{
if (urandfd >= 0)
close (urandfd);
@@ -185,10 +182,7 @@ urandom_close ()
#endif
static ssize_t
-getrandom (buf, len, flags)
- void *buf;
- size_t len;
- unsigned int flags;
+getrandom (void *buf, size_t len, unsigned int flags)
{
int oflags;
ssize_t r;
@@ -220,7 +214,7 @@ getrandom (buf, len, flags)
#endif
u_bits32_t
-get_urandom32 ()
+get_urandom32 (void)
{
u_bits32_t ret;
diff --git a/lib/sh/rename.c b/lib/sh/rename.c
index e410b5e8..2bd807f7 100644
--- a/lib/sh/rename.c
+++ b/lib/sh/rename.c
@@ -2,7 +2,7 @@
* rename - rename a file
*/
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -39,8 +39,7 @@ extern int errno;
#endif
int
-rename (from, to)
- const char *from, *to;
+rename (const char *from, const char *to)
{
struct stat fb, tb;
diff --git a/lib/sh/setlinebuf.c b/lib/sh/setlinebuf.c
index dd76e9fc..249067b7 100644
--- a/lib/sh/setlinebuf.c
+++ b/lib/sh/setlinebuf.c
@@ -35,8 +35,7 @@ static char *stderrbuf = 0;
/* Cause STREAM to buffer lines as opposed to characters or blocks. */
int
-sh_setlinebuf (stream)
- FILE *stream;
+sh_setlinebuf (FILE *stream)
{
#if !defined (HAVE_SETLINEBUF) && !defined (HAVE_SETVBUF)
return (0);
diff --git a/lib/sh/shmatch.c b/lib/sh/shmatch.c
index a717d45c..6bcfc603 100644
--- a/lib/sh/shmatch.c
+++ b/lib/sh/shmatch.c
@@ -46,10 +46,7 @@ extern SHELL_VAR *builtin_find_indexed_array (char *, int);
#endif
int
-sh_regmatch (string, pattern, flags)
- const char *string;
- const char *pattern;
- int flags;
+sh_regmatch (const char *string, const char *pattern, int flags)
{
regex_t regex = { 0 };
regmatch_t *matches;
diff --git a/lib/sh/shmbchar.c b/lib/sh/shmbchar.c
index f2f2582b..22a6de29 100644
--- a/lib/sh/shmbchar.c
+++ b/lib/sh/shmbchar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006, 2009, 2010, 2012, 2015-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2009, 2010, 2012, 2015-2018, 2022 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -51,8 +51,7 @@ extern int utf8_mblen (const char *, size_t);
/* Count the number of characters in S, counting multi-byte characters as a
single character. */
size_t
-mbstrlen (s)
- const char *s;
+mbstrlen (const char *s)
{
size_t clen, nc;
mbstate_t mbs = { 0 }, mbsbak = { 0 };
@@ -81,8 +80,7 @@ mbstrlen (s)
/* XXX - if we know that the locale is UTF-8, we can just check whether or
not any byte has the eighth bit turned on */
char *
-mbsmbchar (s)
- const char *s;
+mbsmbchar (const char *s)
{
char *t;
size_t clen;
@@ -115,10 +113,7 @@ mbsmbchar (s)
}
int
-sh_mbsnlen(src, srclen, maxlen)
- const char *src;
- size_t srclen;
- int maxlen;
+sh_mbsnlen(const char *src, size_t srclen, int maxlen)
{
int count;
int sind;
diff --git a/lib/sh/shquote.c b/lib/sh/shquote.c
index 26fe0185..adf441c1 100644
--- a/lib/sh/shquote.c
+++ b/lib/sh/shquote.c
@@ -1,6 +1,6 @@
/* shquote - functions to quote and dequote strings */
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -36,8 +36,8 @@
#include "shmbchar.h"
#include "shmbutil.h"
-extern char *ansic_quote PARAMS((char *, int, int *));
-extern int ansic_shouldquote PARAMS((const char *));
+extern char *ansic_quote (char *, int, int *);
+extern int ansic_shouldquote (const char *);
/* Default set of characters that should be backslash-quoted in strings */
static const char bstab[256] =
@@ -92,8 +92,7 @@ static const char bstab[256] =
/* Return a new string which is the single-quoted version of STRING.
Used by alias and trap, among others. */
char *
-sh_single_quote (string)
- const char *string;
+sh_single_quote (const char *string)
{
register int c;
char *result, *r;
@@ -132,8 +131,7 @@ sh_single_quote (string)
/* Quote STRING using double quotes. Return a new string. */
char *
-sh_double_quote (string)
- const char *string;
+sh_double_quote (const char *string)
{
register unsigned char c;
int mb_cur_max;
@@ -180,9 +178,7 @@ sh_double_quote (string)
/* Turn S into a simple double-quoted string. If FLAGS is non-zero, quote
double quote characters in S with backslashes. */
char *
-sh_mkdoublequoted (s, slen, flags)
- const char *s;
- int slen, flags;
+sh_mkdoublequoted (const char *s, int slen, int flags)
{
char *r, *ret;
const char *send;
@@ -220,8 +216,7 @@ sh_mkdoublequoted (s, slen, flags)
double quotes. Return a new string. XXX - should this handle CTLESC
and CTLNUL? */
char *
-sh_un_double_quote (string)
- char *string;
+sh_un_double_quote (char *string)
{
register int c, pass_next;
char *result, *r, *s;
@@ -259,10 +254,7 @@ sh_un_double_quote (string)
other shell blank characters. */
char *
-sh_backslash_quote (string, table, flags)
- char *string;
- char *table;
- int flags;
+sh_backslash_quote (char *string, char *table, int flags)
{
int c, mb_cur_max;
size_t slen;
@@ -315,9 +307,7 @@ sh_backslash_quote (string, table, flags)
/* Quote characters that get special treatment when in double quotes in STRING
using backslashes. FLAGS is reserved for future use. Return a new string. */
char *
-sh_backslash_quote_for_double_quotes (string, flags)
- char *string;
- int flags;
+sh_backslash_quote_for_double_quotes (char *string, int flags)
{
unsigned char c;
char *result, *r, *s, *send;
@@ -358,9 +348,7 @@ sh_backslash_quote_for_double_quotes (string, flags)
#endif /* PROMPT_STRING_DECODE */
char *
-sh_quote_reusable (s, flags)
- char *s;
- int flags;
+sh_quote_reusable (char *s, int flags)
{
char *ret;
@@ -383,8 +371,7 @@ sh_quote_reusable (s, flags)
}
int
-sh_contains_shell_metas (string)
- const char *string;
+sh_contains_shell_metas (const char *string)
{
const char *s;
@@ -418,8 +405,7 @@ sh_contains_shell_metas (string)
}
int
-sh_contains_quotes (string)
- const char *string;
+sh_contains_quotes (const char *string)
{
const char *s;
diff --git a/lib/sh/shtty.c b/lib/sh/shtty.c
index 0433f5e2..027941ca 100644
--- a/lib/sh/shtty.c
+++ b/lib/sh/shtty.c
@@ -2,7 +2,7 @@
* shtty.c -- abstract interface to the terminal, focusing on capabilities.
*/
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -34,9 +34,7 @@ static TTYSTRUCT ttin, ttout;
static int ttsaved = 0;
int
-ttgetattr(fd, ttp)
-int fd;
-TTYSTRUCT *ttp;
+ttgetattr(int fd, TTYSTRUCT *ttp)
{
#ifdef TERMIOS_TTY_DRIVER
return tcgetattr(fd, ttp);
@@ -50,9 +48,7 @@ TTYSTRUCT *ttp;
}
int
-ttsetattr(fd, ttp)
-int fd;
-TTYSTRUCT *ttp;
+ttsetattr(int fd, TTYSTRUCT *ttp)
{
#ifdef TERMIOS_TTY_DRIVER
return tcsetattr(fd, TCSADRAIN, ttp);
@@ -66,7 +62,7 @@ TTYSTRUCT *ttp;
}
void
-ttsave()
+ttsave(void)
{
if (ttsaved)
return;
@@ -76,7 +72,7 @@ ttsave()
}
void
-ttrestore()
+ttrestore(void)
{
if (ttsaved == 0)
return;
@@ -87,8 +83,7 @@ ttrestore()
/* Retrieve the internally-saved attributes associated with tty fd FD. */
TTYSTRUCT *
-ttattr (fd)
- int fd;
+ttattr (int fd)
{
if (ttsaved == 0)
return ((TTYSTRUCT *)0);
@@ -105,8 +100,7 @@ ttattr (fd)
* ttsetattr, the terminal will be in one-char-at-a-time mode.
*/
int
-tt_setonechar(ttp)
- TTYSTRUCT *ttp;
+tt_setonechar(TTYSTRUCT *ttp)
{
#if defined (TERMIOS_TTY_DRIVER) || defined (TERMIO_TTY_DRIVER)
@@ -151,9 +145,7 @@ tt_setonechar(ttp)
/* Set the tty associated with FD and TTP into one-character-at-a-time mode */
int
-ttfd_onechar (fd, ttp)
- int fd;
- TTYSTRUCT *ttp;
+ttfd_onechar (int fd, TTYSTRUCT *ttp)
{
if (tt_setonechar(ttp) < 0)
return -1;
@@ -162,7 +154,7 @@ ttfd_onechar (fd, ttp)
/* Set the terminal into one-character-at-a-time mode */
int
-ttonechar ()
+ttonechar (void)
{
TTYSTRUCT tt;
@@ -177,8 +169,7 @@ ttonechar ()
* ttsetattr, the terminal will be in no-echo mode.
*/
int
-tt_setnoecho(ttp)
- TTYSTRUCT *ttp;
+tt_setnoecho(TTYSTRUCT *ttp)
{
#if defined (TERMIOS_TTY_DRIVER) || defined (TERMIO_TTY_DRIVER)
ttp->c_lflag &= ~(ECHO|ECHOK|ECHONL);
@@ -191,9 +182,7 @@ tt_setnoecho(ttp)
/* Set the tty associated with FD and TTP into no-echo mode */
int
-ttfd_noecho (fd, ttp)
- int fd;
- TTYSTRUCT *ttp;
+ttfd_noecho (int fd, TTYSTRUCT *ttp)
{
if (tt_setnoecho (ttp) < 0)
return -1;
@@ -202,7 +191,7 @@ ttfd_noecho (fd, ttp)
/* Set the terminal into no-echo mode */
int
-ttnoecho ()
+ttnoecho (void)
{
TTYSTRUCT tt;
@@ -217,8 +206,7 @@ ttnoecho ()
* ttsetattr, the terminal will be in eight-bit mode (pass8).
*/
int
-tt_seteightbit (ttp)
- TTYSTRUCT *ttp;
+tt_seteightbit (TTYSTRUCT *ttp)
{
#if defined (TERMIOS_TTY_DRIVER) || defined (TERMIO_TTY_DRIVER)
ttp->c_iflag &= ~ISTRIP;
@@ -233,9 +221,7 @@ tt_seteightbit (ttp)
/* Set the tty associated with FD and TTP into eight-bit mode */
int
-ttfd_eightbit (fd, ttp)
- int fd;
- TTYSTRUCT *ttp;
+ttfd_eightbit (int fd, TTYSTRUCT *ttp)
{
if (tt_seteightbit (ttp) < 0)
return -1;
@@ -244,7 +230,7 @@ ttfd_eightbit (fd, ttp)
/* Set the terminal into eight-bit mode */
int
-tteightbit ()
+tteightbit (void)
{
TTYSTRUCT tt;
@@ -259,8 +245,7 @@ tteightbit ()
* ttsetattr, the terminal will be in non-canonical input mode.
*/
int
-tt_setnocanon (ttp)
- TTYSTRUCT *ttp;
+tt_setnocanon (TTYSTRUCT *ttp)
{
#if defined (TERMIOS_TTY_DRIVER) || defined (TERMIO_TTY_DRIVER)
ttp->c_lflag &= ~ICANON;
@@ -271,9 +256,7 @@ tt_setnocanon (ttp)
/* Set the tty associated with FD and TTP into non-canonical mode */
int
-ttfd_nocanon (fd, ttp)
- int fd;
- TTYSTRUCT *ttp;
+ttfd_nocanon (int fd, TTYSTRUCT *ttp)
{
if (tt_setnocanon (ttp) < 0)
return -1;
@@ -282,7 +265,7 @@ ttfd_nocanon (fd, ttp)
/* Set the terminal into non-canonical mode */
int
-ttnocanon ()
+ttnocanon (void)
{
TTYSTRUCT tt;
@@ -297,8 +280,7 @@ ttnocanon ()
* ttsetattr, the terminal will be in cbreak, no-echo mode.
*/
int
-tt_setcbreak(ttp)
- TTYSTRUCT *ttp;
+tt_setcbreak(TTYSTRUCT *ttp)
{
if (tt_setonechar (ttp) < 0)
return -1;
@@ -308,9 +290,7 @@ tt_setcbreak(ttp)
/* Set the tty associated with FD and TTP into cbreak (no-echo,
one-character-at-a-time) mode */
int
-ttfd_cbreak (fd, ttp)
- int fd;
- TTYSTRUCT *ttp;
+ttfd_cbreak (int fd, TTYSTRUCT *ttp)
{
if (tt_setcbreak (ttp) < 0)
return -1;
@@ -319,7 +299,7 @@ ttfd_cbreak (fd, ttp)
/* Set the terminal into cbreak (no-echo, one-character-at-a-time) mode */
int
-ttcbreak ()
+ttcbreak (void)
{
TTYSTRUCT tt;
diff --git a/lib/sh/snprintf.c b/lib/sh/snprintf.c
index 1f0f4c73..678048c2 100644
--- a/lib/sh/snprintf.c
+++ b/lib/sh/snprintf.c
@@ -9,7 +9,7 @@
Unix snprintf implementation.
derived from inetutils/libinetutils/snprintf.c Version 1.1
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -129,8 +129,8 @@
# define FL_ADDBASE 0x02 /* add base# prefix to converted value */
# define FL_HEXUPPER 0x04 /* use uppercase when converting to hex */
# define FL_UNSIGNED 0x08 /* don't add any sign */
-extern char *fmtulong PARAMS((unsigned long int, int, char *, size_t, int));
-extern char *fmtullong PARAMS((unsigned long long int, int, char *, size_t, int));
+extern char *fmtulong (unsigned long int, int, char *, size_t, int);
+extern char *fmtullong (unsigned long long int, int, char *, size_t, int);
#endif
#ifndef FREE
@@ -271,38 +271,38 @@ struct DATA
/* the floating point stuff */
#ifdef FLOATING_POINT
-static double pow_10 PARAMS((int));
-static int log_10 PARAMS((double));
-static double integral PARAMS((double, double *));
-static char *numtoa PARAMS((double, int, int, char **));
+static double pow_10 (int);
+static int log_10 (double);
+static double integral (double, double *);
+static char *numtoa (double, int, int, char **);
#endif
-static void init_data PARAMS((struct DATA *, char *, size_t, const char *, int));
-static void init_conv_flag PARAMS((struct DATA *));
+static void init_data (struct DATA *, char *, size_t, const char *, int);
+static void init_conv_flag (struct DATA *);
/* for the format */
#ifdef FLOATING_POINT
-static void floating PARAMS((struct DATA *, double));
-static void exponent PARAMS((struct DATA *, double));
+static void floating (struct DATA *, double);
+static void exponent (struct DATA *, double);
#endif
-static void number PARAMS((struct DATA *, unsigned long, int));
+static void number (struct DATA *, unsigned long, int);
#ifdef HAVE_LONG_LONG_INT
-static void lnumber PARAMS((struct DATA *, unsigned long long, int));
+static void lnumber (struct DATA *, unsigned long long, int);
#endif
-static void pointer PARAMS((struct DATA *, unsigned long));
-static void strings PARAMS((struct DATA *, char *));
+static void pointer (struct DATA *, unsigned long);
+static void strings (struct DATA *, char *);
#ifdef FLOATING_POINT
# define FALLBACK_FMTSIZE 32
# define FALLBACK_BASE 4096
# define LFALLBACK_BASE 5120
# ifdef HAVE_LONG_DOUBLE
-static void ldfallback PARAMS((struct DATA *, const char *, const char *, long double));
+static void ldfallback (struct DATA *, const char *, const char *, long double);
# endif
-static void dfallback PARAMS((struct DATA *, const char *, const char *, double));
+static void dfallback (struct DATA *, const char *, const char *, double);
#endif
-static char *groupnum PARAMS((char *));
+static char *groupnum (char *);
#if defined (HAVE_LONG_DOUBLE)
# define LONGDOUBLE long double
@@ -331,10 +331,10 @@ static char *groupnum PARAMS((char *));
#endif
#ifdef DRIVER
-static void memory_error_and_abort ();
-static void *xmalloc PARAMS((size_t));
-static void *xrealloc PARAMS((void *, size_t));
-static void xfree PARAMS((void *));
+static void memory_error_and_abort (void);
+static void *xmalloc (size_t);
+static void *xrealloc (void *, size_t);
+static void xfree (void *);
#else
# include <xmalloc.h>
#endif
@@ -470,8 +470,7 @@ static void xfree PARAMS((void *));
* Find the nth power of 10
*/
static double
-pow_10(n)
- int n;
+pow_10(int n)
{
double P;
@@ -514,8 +513,7 @@ pow_10(n)
* NOTE: do not call this with r == 0 -- an infinite loop results.
*/
static int
-log_10(r)
- double r;
+log_10(double r)
{
int i = 0;
double result = 1.;
@@ -549,9 +547,7 @@ log_10(r)
* In many ways it resemble the modf() found on most Un*x
*/
static double
-integral(real, ip)
- double real;
- double *ip;
+integral(double real, double *ip)
{
int j;
double i, s, p;
@@ -598,10 +594,7 @@ integral(real, ip)
* declare with fix size
*/
static char *
-numtoa(number, base, precision, fract)
- double number;
- int base, precision;
- char **fract;
+numtoa(double number, int base, int precision, char **fract)
{
register int i, j;
double ip, fp; /* integer and fraction part */
@@ -696,10 +689,7 @@ numtoa(number, base, precision, fract)
* the representation with the right padding
*/
static void
-number(p, d, base)
- struct DATA *p;
- unsigned long d;
- int base;
+number(struct DATA *p, unsigned long d, int base)
{
char *tmp, *t;
long sd;
@@ -772,10 +762,7 @@ number(p, d, base)
* identical to number() but works for `long long'
*/
static void
-lnumber(p, d, base)
- struct DATA *p;
- unsigned long long d;
- int base;
+lnumber(struct DATA *p, unsigned long long d, int base)
{
char *tmp, *t;
long long sd;
@@ -844,9 +831,7 @@ lnumber(p, d, base)
#endif
static void
-pointer(p, d)
- struct DATA *p;
- unsigned long d;
+pointer(struct DATA *p, unsigned long d)
{
char *tmp;
@@ -869,9 +854,7 @@ pointer(p, d)
/* %s strings */
static void
-strings(p, tmp)
- struct DATA *p;
- char *tmp;
+strings(struct DATA *p, char *tmp)
{
size_t len;
@@ -886,9 +869,7 @@ strings(p, tmp)
#if HANDLE_MULTIBYTE
/* %ls wide-character strings */
static void
-wstrings(p, tmp)
- struct DATA *p;
- wchar_t *tmp;
+wstrings(struct DATA *p, wchar_t *tmp)
{
size_t len;
mbstate_t mbs;
@@ -927,9 +908,7 @@ wstrings(p, tmp)
}
static void
-wchars (p, wc)
- struct DATA *p;
- wint_t wc;
+wchars (struct DATA *p, wint_t wc)
{
char *lbuf, *l;
mbstate_t mbs;
@@ -956,10 +935,7 @@ wchars (p, wc)
(mode == 2) we check for NaN. This does the necessary printing. Returns
1 if Inf or Nan, 0 if not. */
static int
-chkinfnan(p, d, mode)
- struct DATA *p;
- double d;
- int mode; /* == 1 for inf, == 2 for nan */
+chkinfnan(struct DATA *p, double d, int mode)
{
int i;
char *tmp;
@@ -987,9 +963,7 @@ chkinfnan(p, d, mode)
/* %f %F %g %G floating point representation */
static void
-floating(p, d)
- struct DATA *p;
- double d;
+floating(struct DATA *p, double d)
{
char *tmp, *tmp2, *t;
int i;
@@ -1058,9 +1032,7 @@ floating(p, d)
/* %e %E %g %G exponent representation */
static void
-exponent(p, d)
- struct DATA *p;
- double d;
+exponent(struct DATA *p, double d)
{
char *tmp, *tmp2;
int j, i;
@@ -1160,8 +1132,7 @@ exponent(p, d)
grouping info and thousands separator. If no grouping should be performed,
this returns NULL; the caller needs to check for it. */
static char *
-groupnum (s)
- char *s;
+groupnum (char *s)
{
char *se, *ret, *re, *g;
int len, slen;
@@ -1221,8 +1192,7 @@ groupnum (s)
/* initialize the conversion specifiers */
static void
-init_conv_flag (p)
- struct DATA *p;
+init_conv_flag (struct DATA *p)
{
p->flags &= PF_ALLOCBUF; /* preserve PF_ALLOCBUF flag */
p->precision = p->width = NOT_FOUND;
@@ -1231,12 +1201,7 @@ init_conv_flag (p)
}
static void
-init_data (p, string, length, format, mode)
- struct DATA *p;
- char *string;
- size_t length;
- const char *format;
- int mode;
+init_data (struct DATA *p, char *string, size_t length, const char *format, int mode)
{
p->length = length - 1; /* leave room for '\0' */
p->holder = p->base = string;
@@ -1246,16 +1211,7 @@ init_data (p, string, length, format, mode)
}
static int
-#if defined (__STDC__)
vsnprintf_internal(struct DATA *data, char *string, size_t length, const char *format, va_list args)
-#else
-vsnprintf_internal(data, string, length, format, args)
- struct DATA *data;
- char *string;
- size_t length;
- const char *format;
- va_list args;
-#endif
{
double d; /* temporary holder */
#ifdef HAVE_LONG_DOUBLE
@@ -1639,10 +1595,7 @@ conv_break:
* at it. Fall back to sprintf for long double formats.
*/
static void
-ldfallback (data, fs, fe, ld)
- struct DATA *data;
- const char *fs, *fe;
- long double ld;
+ldfallback (struct DATA *data, const char *fs, const char *fe, long double ld)
{
register char *x;
char fmtbuf[FALLBACK_FMTSIZE], *obuf;
@@ -1672,10 +1625,7 @@ ldfallback (data, fs, fe, ld)
#ifdef FLOATING_POINT
/* Used for %a, %A if the libc printf supports them. */
static void
-dfallback (data, fs, fe, d)
- struct DATA *data;
- const char *fs, *fe;
- double d;
+dfallback (struct DATA *data, const char *fs, const char *fe, double d)
{
register char *x;
char fmtbuf[FALLBACK_FMTSIZE], obuf[FALLBACK_BASE];
@@ -1702,15 +1652,7 @@ dfallback (data, fs, fe, d)
#if !HAVE_SNPRINTF
int
-#if defined (__STDC__)
vsnprintf(char *string, size_t length, const char *format, va_list args)
-#else
-vsnprintf(string, length, format, args)
- char *string;
- size_t length;
- const char *format;
- va_list args;
-#endif
{
struct DATA data;
@@ -1721,15 +1663,7 @@ vsnprintf(string, length, format, args)
}
int
-#if defined(PREFER_STDARG)
snprintf(char *string, size_t length, const char * format, ...)
-#else
-snprintf(string, length, format, va_alist)
- char *string;
- size_t length;
- const char *format;
- va_dcl
-#endif
{
struct DATA data;
int rval;
@@ -1752,14 +1686,7 @@ snprintf(string, length, format, va_alist)
#if !HAVE_ASPRINTF
int
-#if defined (__STDC__)
vasprintf(char **stringp, const char *format, va_list args)
-#else
-vasprintf(stringp, format, args)
- char **stringp;
- const char *format;
- va_list args;
-#endif
{
struct DATA data;
char *string;
@@ -1773,14 +1700,7 @@ vasprintf(stringp, format, args)
}
int
-#if defined(PREFER_STDARG)
asprintf(char **stringp, const char * format, ...)
-#else
-asprintf(stringp, format, va_alist)
- char **stringp;
- const char *format;
- va_dcl
-#endif
{
int rval;
va_list args;
@@ -1801,15 +1721,14 @@ asprintf(stringp, format, va_alist)
#ifdef DRIVER
static void
-memory_error_and_abort ()
+memory_error_and_abort (void)
{
write (2, "out of virtual memory\n", 22);
abort ();
}
static void *
-xmalloc(bytes)
- size_t bytes;
+xmalloc(size_t bytes)
{
void *ret;
@@ -1820,9 +1739,7 @@ xmalloc(bytes)
}
static void *
-xrealloc (pointer, bytes)
- void *pointer;
- size_t bytes;
+xrealloc (void *pointer, size_t bytes)
{
void *ret;
@@ -1833,15 +1750,14 @@ xrealloc (pointer, bytes)
}
static void
-xfree(x)
- void *x;
+xfree(void *x)
{
if (x)
free (x);
}
/* set of small tests for snprintf() */
-main()
+main(int c, char **v)
{
char holder[100];
char *h;
diff --git a/lib/sh/spell.c b/lib/sh/spell.c
index cdf465b2..d25e4135 100644
--- a/lib/sh/spell.c
+++ b/lib/sh/spell.c
@@ -1,6 +1,6 @@
/* spell.c -- spelling correction for pathnames. */
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -40,8 +40,8 @@
#include <maxpath.h>
#include <stdc.h>
-static int mindist PARAMS((char *, char *, char *));
-static int spdist PARAMS((char *, char *));
+static int mindist (char *, char *, char *);
+static int spdist (char *, char *);
/*
* `spname' and its helpers are inspired by the code in "The UNIX
@@ -59,9 +59,7 @@ static int spdist PARAMS((char *, char *));
* Stores corrected name in `newname'.
*/
int
-spname(oldname, newname)
- char *oldname;
- char *newname;
+spname(char *oldname, char *newname)
{
char *op, *np, *p;
char guess[PATH_MAX + 1], best[PATH_MAX + 1];
@@ -104,10 +102,7 @@ spname(oldname, newname)
* Search directory for a guess
*/
static int
-mindist(dir, guess, best)
- char *dir;
- char *guess;
- char *best;
+mindist(char *dir, char *guess, char *best)
{
DIR *fd;
struct dirent *dp;
@@ -155,8 +150,7 @@ mindist(dir, guess, best)
* 3 otherwise
*/
static int
-spdist(cur, new)
- char *cur, *new;
+spdist(char *cur, char *new)
{
while (*cur == *new)
{
@@ -188,8 +182,7 @@ spdist(cur, new)
}
char *
-dirspell (dirname)
- char *dirname;
+dirspell (char *dirname)
{
int n;
char *guess;
diff --git a/lib/sh/strcasecmp.c b/lib/sh/strcasecmp.c
index 70d0551a..e68dffc6 100644
--- a/lib/sh/strcasecmp.c
+++ b/lib/sh/strcasecmp.c
@@ -1,6 +1,6 @@
/* strcasecmp.c - functions for case-insensitive string comparison. */
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -29,10 +29,7 @@
/* Compare at most COUNT characters from string1 to string2. Case
doesn't matter. */
int
-strncasecmp (string1, string2, count)
- const char *string1;
- const char *string2;
- size_t count;
+strncasecmp (const char *string1, const char *string2, size_t count)
{
register const char *s1;
register const char *s2;
@@ -58,9 +55,7 @@ strncasecmp (string1, string2, count)
/* strcmp (), but caseless. */
int
-strcasecmp (string1, string2)
- const char *string1;
- const char *string2;
+strcasecmp (const char *string1, const char *string2)
{
register const char *s1;
register const char *s2;
diff --git a/lib/sh/strcasestr.c b/lib/sh/strcasestr.c
index c819b3eb..7239277a 100644
--- a/lib/sh/strcasestr.c
+++ b/lib/sh/strcasestr.c
@@ -1,7 +1,7 @@
/* strcasestr.c - Find if one string appears as a substring of another string,
without regard to case. */
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -30,9 +30,7 @@
match in s1. The compare is case insensitive. This is a
case-insensitive strstr(3). */
char *
-strcasestr (s1, s2)
- const char *s1;
- const char *s2;
+strcasestr (const char *s1, const char *s2)
{
register int i, l, len, c;
diff --git a/lib/sh/strchrnul.c b/lib/sh/strchrnul.c
index 00cb88c4..65273af2 100644
--- a/lib/sh/strchrnul.c
+++ b/lib/sh/strchrnul.c
@@ -1,5 +1,5 @@
/* Searching in a string.
- Copyright (C) 2012 Free Software Foundation, Inc.
+ Copyright (C) 2012, 2022 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,9 +22,7 @@
/* Find the first occurrence of C in S or the final NUL byte. */
char *
-strchrnul (s, c_in)
- const char *s;
- int c_in;
+strchrnul (const char *s, int c_in)
{
char c;
register char *s1;
diff --git a/lib/sh/strdup.c b/lib/sh/strdup.c
index 3d35f7c0..51f6dea6 100644
--- a/lib/sh/strdup.c
+++ b/lib/sh/strdup.c
@@ -1,6 +1,6 @@
/* strdup - return a copy of a string in newly-allocated memory. */
-/* Copyright (C) 2013 Free Software Foundation, Inc.
+/* Copyright (C) 2013,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -26,8 +26,7 @@
/* Duplicate S, returning an identical malloc'd string. */
char *
-strdup (s)
- const char *s;
+strdup (const char *s)
{
size_t len;
void *new;
diff --git a/lib/sh/strerror.c b/lib/sh/strerror.c
index bf639263..0de2f800 100644
--- a/lib/sh/strerror.c
+++ b/lib/sh/strerror.c
@@ -1,6 +1,6 @@
/* strerror.c - string corresponding to a particular value of errno. */
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -49,8 +49,7 @@ extern int errno;
static char *errbase = "Unknown system error ";
char *
-strerror (e)
- int e;
+strerror (int e)
{
static char emsg[40];
#if defined (HAVE_SYS_ERRLIST)
diff --git a/lib/sh/stringlist.c b/lib/sh/stringlist.c
index 3f28b631..8c1de7c7 100644
--- a/lib/sh/stringlist.c
+++ b/lib/sh/stringlist.c
@@ -1,6 +1,6 @@
/* stringlist.c - functions to handle a generic `list of strings' structure */
-/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2019, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -37,8 +37,7 @@
/* Allocate a new STRINGLIST, with room for N strings. */
STRINGLIST *
-strlist_create (n)
- int n;
+strlist_create (int n)
{
STRINGLIST *ret;
register int i;
@@ -61,9 +60,7 @@ strlist_create (n)
}
STRINGLIST *
-strlist_resize (sl, n)
- STRINGLIST *sl;
- int n;
+strlist_resize (STRINGLIST *sl, int n)
{
register int i;
@@ -81,8 +78,7 @@ strlist_resize (sl, n)
}
void
-strlist_flush (sl)
- STRINGLIST *sl;
+strlist_flush (STRINGLIST *sl)
{
if (sl == 0 || sl->list == 0)
return;
@@ -91,8 +87,7 @@ strlist_flush (sl)
}
void
-strlist_dispose (sl)
- STRINGLIST *sl;
+strlist_dispose (STRINGLIST *sl)
{
if (sl == 0)
return;
@@ -102,9 +97,7 @@ strlist_dispose (sl)
}
int
-strlist_remove (sl, s)
- STRINGLIST *sl;
- char *s;
+strlist_remove (STRINGLIST *sl, char *s)
{
int r;
@@ -118,8 +111,7 @@ strlist_remove (sl, s)
}
STRINGLIST *
-strlist_copy (sl)
- STRINGLIST *sl;
+strlist_copy (STRINGLIST *sl)
{
STRINGLIST *new;
register int i;
@@ -144,8 +136,7 @@ strlist_copy (sl)
/* Return a new STRINGLIST with everything from M1 and M2. */
STRINGLIST *
-strlist_merge (m1, m2)
- STRINGLIST *m1, *m2;
+strlist_merge (STRINGLIST *m1, STRINGLIST *m2)
{
STRINGLIST *sl;
int i, n, l1, l2;
@@ -165,8 +156,7 @@ strlist_merge (m1, m2)
/* Make STRINGLIST M1 contain everything in M1 and M2. */
STRINGLIST *
-strlist_append (m1, m2)
- STRINGLIST *m1, *m2;
+strlist_append (STRINGLIST *m1, STRINGLIST *m2)
{
register int i, n, len1, len2;
@@ -189,9 +179,7 @@ strlist_append (m1, m2)
}
STRINGLIST *
-strlist_prefix_suffix (sl, prefix, suffix)
- STRINGLIST *sl;
- char *prefix, *suffix;
+strlist_prefix_suffix (STRINGLIST *sl, char *prefix, char *suffix)
{
int plen, slen, tlen, llen, i;
char *t;
@@ -223,9 +211,7 @@ strlist_prefix_suffix (sl, prefix, suffix)
}
void
-strlist_print (sl, prefix)
- STRINGLIST *sl;
- char *prefix;
+strlist_print (STRINGLIST *sl, char *prefix)
{
register int i;
@@ -236,9 +222,7 @@ strlist_print (sl, prefix)
}
void
-strlist_walk (sl, func)
- STRINGLIST *sl;
- sh_strlist_map_func_t *func;
+strlist_walk (STRINGLIST *sl, sh_strlist_map_func_t *func)
{
register int i;
@@ -250,8 +234,7 @@ strlist_walk (sl, func)
}
void
-strlist_sort (sl)
- STRINGLIST *sl;
+strlist_sort (STRINGLIST *sl)
{
if (sl == 0 || sl->list_len == 0 || sl->list == 0)
return;
@@ -259,9 +242,7 @@ strlist_sort (sl)
}
STRINGLIST *
-strlist_from_word_list (list, alloc, starting_index, ip)
- WORD_LIST *list;
- int alloc, starting_index, *ip;
+strlist_from_word_list (WORD_LIST *list, int alloc, int starting_index, int *ip)
{
STRINGLIST *ret;
int slen, len;
@@ -283,9 +264,7 @@ strlist_from_word_list (list, alloc, starting_index, ip)
}
WORD_LIST *
-strlist_to_word_list (sl, alloc, starting_index)
- STRINGLIST *sl;
- int alloc, starting_index;
+strlist_to_word_list (STRINGLIST *sl, int alloc, int starting_index)
{
WORD_LIST *list;
diff --git a/lib/sh/stringvec.c b/lib/sh/stringvec.c
index 86000429..fd3d3e47 100644
--- a/lib/sh/stringvec.c
+++ b/lib/sh/stringvec.c
@@ -1,6 +1,6 @@
/* stringvec.c - functions for managing arrays of strings. */
-/* Copyright (C) 2000-2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2002,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -34,40 +34,33 @@
/* Allocate an array of strings with room for N members. */
char **
-strvec_create (n)
- int n;
+strvec_create (int n)
{
return ((char **)xmalloc ((n) * sizeof (char *)));
}
/* Allocate an array of strings with room for N members. */
char **
-strvec_mcreate (n)
- int n;
+strvec_mcreate (int n)
{
return ((char **)malloc ((n) * sizeof (char *)));
}
char **
-strvec_resize (array, nsize)
- char **array;
- int nsize;
+strvec_resize (char **array, int nsize)
{
return ((char **)xrealloc (array, nsize * sizeof (char *)));
}
char **
-strvec_mresize (array, nsize)
- char **array;
- int nsize;
+strvec_mresize (char **array, int nsize)
{
return ((char **)realloc (array, nsize * sizeof (char *)));
}
/* Return the length of ARRAY, a NULL terminated array of char *. */
int
-strvec_len (array)
- char **array;
+strvec_len (char **array)
{
register int i;
@@ -77,8 +70,7 @@ strvec_len (array)
/* Free the contents of ARRAY, a NULL terminated array of char *. */
void
-strvec_flush (array)
- char **array;
+strvec_flush (char **array)
{
register int i;
@@ -90,8 +82,7 @@ strvec_flush (array)
}
void
-strvec_dispose (array)
- char **array;
+strvec_dispose (char **array)
{
if (array == 0)
return;
@@ -101,8 +92,7 @@ strvec_dispose (array)
}
int
-strvec_remove (array, name)
- char **array, *name;
+strvec_remove (char **array, char *name)
{
register int i, j;
char *x;
@@ -125,8 +115,7 @@ strvec_remove (array, name)
/* Find NAME in ARRAY. Return the index of NAME, or -1 if not present.
ARRAY should be NULL terminated. */
int
-strvec_search (array, name)
- char **array, *name;
+strvec_search (char **array, char *name)
{
int i;
@@ -139,8 +128,7 @@ strvec_search (array, name)
/* Allocate and return a new copy of ARRAY and its contents. */
char **
-strvec_copy (array)
- char **array;
+strvec_copy (char **array)
{
register int i;
int len;
@@ -161,8 +149,7 @@ strvec_copy (array)
Perform a bytewise comparison if *S1 and *S2 collate equally. */
int
-strvec_posixcmp (s1, s2)
- register char **s1, **s2;
+strvec_posixcmp (char **s1, char **s2)
{
int result;
@@ -181,8 +168,7 @@ strvec_posixcmp (s1, s2)
/* Comparison routine for use with qsort() on arrays of strings. Uses
strcoll(3) if available, otherwise it uses strcmp(3). */
int
-strvec_strcmp (s1, s2)
- register char **s1, **s2;
+strvec_strcmp (char **s1, char **s2)
{
#if defined (HAVE_STRCOLL)
return (strcoll (*s1, *s2));
@@ -198,9 +184,7 @@ strvec_strcmp (s1, s2)
/* Sort ARRAY, a null terminated array of pointers to strings. */
void
-strvec_sort (array, posix)
- char **array;
- int posix;
+strvec_sort (char **array, int posix)
{
if (posix)
qsort (array, strvec_len (array), sizeof (char *), (QSFUNC *)strvec_posixcmp);
@@ -217,9 +201,7 @@ strvec_sort (array, posix)
space at the beginning of the array. */
char **
-strvec_from_word_list (list, alloc, starting_index, ip)
- WORD_LIST *list;
- int alloc, starting_index, *ip;
+strvec_from_word_list (WORD_LIST *list, int alloc, int starting_index, int *ip)
{
int count;
char **array;
@@ -244,9 +226,7 @@ strvec_from_word_list (list, alloc, starting_index, ip)
in ARRAY to begin. */
WORD_LIST *
-strvec_to_word_list (array, alloc, starting_index)
- char **array;
- int alloc, starting_index;
+strvec_to_word_list (char **array, int alloc, int starting_index)
{
WORD_LIST *list;
WORD_DESC *w;
diff --git a/lib/sh/strnlen.c b/lib/sh/strnlen.c
index 10414d35..06eaa0b9 100644
--- a/lib/sh/strnlen.c
+++ b/lib/sh/strnlen.c
@@ -1,6 +1,6 @@
/* strnlen - return length of passed string, with length limit */
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -35,9 +35,7 @@
/* Find the length of S, but scan at most MAXLEN characters. If no '\0'
terminator is found within the first MAXLEN characters, return MAXLEN. */
size_t
-strnlen (s, maxlen)
- register const char *s;
- size_t maxlen;
+strnlen (register const char *s, size_t maxlen)
{
register const char *e;
size_t n;
diff --git a/lib/sh/strpbrk.c b/lib/sh/strpbrk.c
index 8cce8308..3ef43401 100644
--- a/lib/sh/strpbrk.c
+++ b/lib/sh/strpbrk.c
@@ -1,6 +1,6 @@
/* strpbrk.c - locate multiple characters in a string */
-/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1994, 2022 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -31,9 +31,7 @@
/* Find the first occurrence in S of any character in ACCEPT. */
char *
-strpbrk (s, accept)
- register const char *s;
- register const char *accept;
+strpbrk (const char *s, const char *accept)
{
while (*s != '\0')
{
diff --git a/lib/sh/strstr.c b/lib/sh/strstr.c
index c43b05e3..fb69f955 100644
--- a/lib/sh/strstr.c
+++ b/lib/sh/strstr.c
@@ -36,7 +36,7 @@
#endif
#include <sys/types.h>
-typedef unsigned chartype;
+typedef unsigned int chartype;
#undef strstr
diff --git a/lib/sh/strtod.c b/lib/sh/strtod.c
index 55e11540..e6c1c360 100644
--- a/lib/sh/strtod.c
+++ b/lib/sh/strtod.c
@@ -1,6 +1,6 @@
/* strtod.c - convert string to double-precision floating-point value. */
-/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -50,15 +50,13 @@ extern int errno;
#endif
#ifndef locale_decpoint
-extern int locale_decpoint PARAMS((void));
+extern int locale_decpoint (void);
#endif
/* Convert NPTR to a double. If ENDPTR is not NULL, a pointer to the
character after the last one used in the number is put in *ENDPTR. */
double
-strtod (nptr, endptr)
- const char *nptr;
- char **endptr;
+strtod (const char *nptr, char **endptr)
{
register const char *s;
short sign;
diff --git a/lib/sh/strtoimax.c b/lib/sh/strtoimax.c
index 584fa0ba..0e6c1c26 100644
--- a/lib/sh/strtoimax.c
+++ b/lib/sh/strtoimax.c
@@ -1,6 +1,6 @@
/* strtoimax - convert string representation of a number into an intmax_t value. */
-/* Copyright 1999-2020 Free Software Foundation, Inc.
+/* Copyright 1999-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -45,14 +45,14 @@
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_STRTOL
-extern long strtol PARAMS((const char *, char **, int));
+extern long strtol (const char *, char **, int);
#endif
#ifndef HAVE_DECL_STRTOLL
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG_INT
-extern long long strtoll PARAMS((const char *, char **, int));
+extern long long strtoll (const char *, char **, int);
#endif
#ifdef strtoimax
@@ -60,10 +60,7 @@ extern long long strtoll PARAMS((const char *, char **, int));
#endif
intmax_t
-strtoimax (ptr, endptr, base)
- const char *ptr;
- char **endptr;
- int base;
+strtoimax (const char *ptr, char **endptr, int base)
{
#if HAVE_LONG_LONG_INT
verify(size_is_that_of_long_or_long_long,
diff --git a/lib/sh/strtol.c b/lib/sh/strtol.c
index c839a97c..ac30dbd9 100644
--- a/lib/sh/strtol.c
+++ b/lib/sh/strtol.c
@@ -1,6 +1,6 @@
/* strtol - convert string representation of a number into a long integer value. */
-/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2001,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -90,10 +90,7 @@ extern int errno;
one converted is stored in *ENDPTR. */
INT
-strtol (nptr, endptr, base)
- const char *nptr;
- char **endptr;
- int base;
+strtol (const char *nptr, char **endptr, int base)
{
int negative;
register unsigned LONG int cutoff;
diff --git a/lib/sh/strtoumax.c b/lib/sh/strtoumax.c
index 2e26efcf..8996f69f 100644
--- a/lib/sh/strtoumax.c
+++ b/lib/sh/strtoumax.c
@@ -1,6 +1,6 @@
/* strtoumax - convert string representation of a number into an uintmax_t value. */
-/* Copyright 1999-2020 Free Software Foundation, Inc.
+/* Copyright 1999-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -45,14 +45,14 @@
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_STRTOUL
-extern unsigned long strtoul PARAMS((const char *, char **, int));
+extern unsigned long strtoul (const char *, char **, int);
#endif
#ifndef HAVE_DECL_STRTOULL
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG_INT
-extern unsigned long long strtoull PARAMS((const char *, char **, int));
+extern unsigned long long strtoull (const char *, char **, int);
#endif
#ifdef strtoumax
@@ -60,10 +60,7 @@ extern unsigned long long strtoull PARAMS((const char *, char **, int));
#endif
uintmax_t
-strtoumax (ptr, endptr, base)
- const char *ptr;
- char **endptr;
- int base;
+strtoumax (const char *ptr, char **endptr, int base)
{
#if HAVE_UNSIGNED_LONG_LONG_INT
verify (size_is_that_of_unsigned_long_or_unsigned_long_long,
diff --git a/lib/sh/strtrans.c b/lib/sh/strtrans.c
index b2b1acca..5d5f7599 100644
--- a/lib/sh/strtrans.c
+++ b/lib/sh/strtrans.c
@@ -1,6 +1,6 @@
/* strtrans.c - Translate and untranslate strings with ANSI-C escape sequences. */
-/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -48,9 +48,7 @@
quote CTLESC and CTLNUL with CTLESC. If (flags&4) is non-zero, we want
to remove the backslash before any unrecognized escape sequence. */
char *
-ansicstr (string, len, flags, sawc, rlen)
- char *string;
- int len, flags, *sawc, *rlen;
+ansicstr (char *string, int len, int flags, int *sawc, int *rlen)
{
int c, temp;
char *ret, *r, *s;
@@ -227,9 +225,7 @@ ansicstr (string, len, flags, sawc, rlen)
/* Take a string STR, possibly containing non-printing characters, and turn it
into a $'...' ANSI-C style quoted string. Returns a new string. */
char *
-ansic_quote (str, flags, rlen)
- char *str;
- int flags, *rlen;
+ansic_quote (char *str, int flags, int *rlen)
{
char *r, *ret, *s;
int l, rsize;
@@ -318,8 +314,7 @@ ansic_quote (str, flags, rlen)
#if defined (HANDLE_MULTIBYTE)
int
-ansic_wshouldquote (string)
- const char *string;
+ansic_wshouldquote (const char *string)
{
const wchar_t *wcs;
wchar_t wcc;
@@ -348,8 +343,7 @@ ansic_wshouldquote (string)
/* return 1 if we need to quote with $'...' because of non-printing chars. */
int
-ansic_shouldquote (string)
- const char *string;
+ansic_shouldquote (const char *string)
{
const char *s;
unsigned char c;
@@ -373,9 +367,7 @@ ansic_shouldquote (string)
/* $'...' ANSI-C expand the portion of STRING between START and END and
return the result. The result cannot be longer than the input string. */
char *
-ansiexpand (string, start, end, lenp)
- char *string;
- int start, end, *lenp;
+ansiexpand (char *string, int start, int end, int *lenp)
{
char *temp, *t;
int len, tlen;
diff --git a/lib/sh/strvis.c b/lib/sh/strvis.c
index 7a11d579..a4d5bf04 100644
--- a/lib/sh/strvis.c
+++ b/lib/sh/strvis.c
@@ -53,12 +53,7 @@
#endif
int
-sh_charvis (s, sindp, slen, ret, rindp)
- const char *s;
- size_t *sindp;
- size_t slen;
- char *ret;
- size_t *rindp;
+sh_charvis (const char *s, size_t *sindp, size_t slen, char *ret, size_t *rindp)
{
unsigned char c;
size_t si, ri;
@@ -117,8 +112,7 @@ sh_charvis (s, sindp, slen, ret, rindp)
/* Return a new string with `unsafe' non-graphical characters in S rendered
in a visible way. */
char *
-sh_strvis (string)
- const char *string;
+sh_strvis (const char *string)
{
size_t slen, sind;
char *ret;
diff --git a/lib/sh/times.c b/lib/sh/times.c
index 2423078a..d8a37685 100644
--- a/lib/sh/times.c
+++ b/lib/sh/times.c
@@ -1,6 +1,6 @@
/* times.c - times(3) library function */
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -30,13 +30,12 @@
# include <sys/resource.h>
#endif /* HAVE_SYS_RESOURCE_H && HAVE_GETRUSAGE */
-extern long get_clk_tck PARAMS((void));
+extern long get_clk_tck (void);
#define CONVTCK(r) (r.tv_sec * clk_tck + r.tv_usec / (1000000 / clk_tck))
clock_t
-times(tms)
- struct tms *tms;
+times(struct tms *tms)
{
clock_t rv;
static long clk_tck = -1;
diff --git a/lib/sh/timeval.c b/lib/sh/timeval.c
index f2ca7624..f50d6244 100644
--- a/lib/sh/timeval.c
+++ b/lib/sh/timeval.c
@@ -1,6 +1,6 @@
/* timeval.c - functions to perform operations on struct timevals */
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -29,14 +29,13 @@
#include <stdc.h>
#ifndef locale_decpoint
-extern int locale_decpoint PARAMS((void));
+extern int locale_decpoint (void);
#endif
#include <stdio.h>
struct timeval *
-difftimeval (d, t1, t2)
- struct timeval *d, *t1, *t2;
+difftimeval (struct timeval *d, struct timeval *t1, struct timeval *t2)
{
d->tv_sec = t2->tv_sec - t1->tv_sec;
d->tv_usec = t2->tv_usec - t1->tv_usec;
@@ -54,8 +53,7 @@ difftimeval (d, t1, t2)
}
struct timeval *
-addtimeval (d, t1, t2)
- struct timeval *d, *t1, *t2;
+addtimeval (struct timeval *d, struct timeval *t1, struct timeval *t2)
{
d->tv_sec = t1->tv_sec + t2->tv_sec;
d->tv_usec = t1->tv_usec + t2->tv_usec;
@@ -68,9 +66,7 @@ addtimeval (d, t1, t2)
}
struct timeval *
-multimeval (d, m)
- struct timeval *d;
- int m;
+multimeval (struct timeval *d, int m)
{
time_t t;
@@ -81,9 +77,7 @@ multimeval (d, m)
}
struct timeval *
-divtimeval (d, m)
- struct timeval *d;
- int m;
+divtimeval (struct timeval *d, int m)
{
time_t t;
@@ -96,8 +90,7 @@ divtimeval (d, m)
/* Do "cpu = ((user + sys) * 10000) / real;" with timevals.
Barely-tested code from Deven T. Corzine <deven@ties.org>. */
int
-timeval_to_cpu (rt, ut, st)
- struct timeval *rt, *ut, *st; /* real, user, sys */
+timeval_to_cpu (struct timeval *rt, struct timeval *ut, struct timeval *st)
{
struct timeval t1, t2;
register int i;
@@ -134,10 +127,7 @@ timeval_to_cpu (rt, ut, st)
second, returning the values in *SP and *SFP, respectively. This does
rounding on the fractional part, not just truncation to three places. */
void
-timeval_to_secs (tvp, sp, sfp)
- struct timeval *tvp;
- time_t *sp;
- int *sfp;
+timeval_to_secs (struct timeval *tvp, time_t *sp, int *sfp)
{
int rest;
@@ -160,9 +150,7 @@ timeval_to_secs (tvp, sp, sfp)
/* Print the contents of a struct timeval * in a standard way to stdio
stream FP. */
void
-print_timeval (fp, tvp)
- FILE *fp;
- struct timeval *tvp;
+print_timeval (FILE *fp, struct timeval *tvp)
{
time_t timestamp;
long minutes;
diff --git a/lib/sh/tmpfile.c b/lib/sh/tmpfile.c
index d107e745..098c111b 100644
--- a/lib/sh/tmpfile.c
+++ b/lib/sh/tmpfile.c
@@ -2,7 +2,7 @@
* tmpfile.c - functions to create and safely open temp files for the shell.
*/
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -58,8 +58,8 @@ extern int errno;
extern pid_t dollar_dollar_pid;
-static char *get_sys_tmpdir PARAMS((void));
-static char *get_tmpdir PARAMS((int));
+static char *get_sys_tmpdir (void);
+static char *get_tmpdir (int);
static char *sys_tmpdir = (char *)NULL;
static int ntmpfiles;
@@ -67,7 +67,7 @@ static int tmpnamelen = -1;
static unsigned long filenum = 1L;
static char *
-get_sys_tmpdir ()
+get_sys_tmpdir (void)
{
if (sys_tmpdir)
return sys_tmpdir;
@@ -96,8 +96,7 @@ get_sys_tmpdir ()
}
static char *
-get_tmpdir (flags)
- int flags;
+get_tmpdir (int flags)
{
char *tdir;
@@ -119,7 +118,7 @@ get_tmpdir (flags)
}
static void
-sh_seedrand ()
+sh_seedrand (void)
{
#if HAVE_RANDOM
int d;
@@ -136,9 +135,7 @@ sh_seedrand ()
}
char *
-sh_mktmpname (nameroot, flags)
- char *nameroot;
- int flags;
+sh_mktmpname (char *nameroot, int flags)
{
char *filename, *tdir, *lroot;
struct stat sb;
@@ -199,10 +196,7 @@ sh_mktmpname (nameroot, flags)
}
int
-sh_mktmpfd (nameroot, flags, namep)
- char *nameroot;
- int flags;
- char **namep;
+sh_mktmpfd (char *nameroot, int flags, char **namep)
{
char *filename, *tdir, *lroot;
int fd, tdlen;
@@ -265,10 +259,7 @@ sh_mktmpfd (nameroot, flags, namep)
}
FILE *
-sh_mktmpfp (nameroot, flags, namep)
- char *nameroot;
- int flags;
- char **namep;
+sh_mktmpfp (char *nameroot, int flags, char **namep)
{
int fd;
FILE *fp;
@@ -283,9 +274,7 @@ sh_mktmpfp (nameroot, flags, namep)
}
char *
-sh_mktmpdir (nameroot, flags)
- char *nameroot;
- int flags;
+sh_mktmpdir (char *nameroot, int flags)
{
char *filename, *tdir, *lroot, *dirname;
int fd, tdlen;
diff --git a/lib/sh/uconvert.c b/lib/sh/uconvert.c
index f3a4cc9f..909686cf 100644
--- a/lib/sh/uconvert.c
+++ b/lib/sh/uconvert.c
@@ -1,7 +1,7 @@
/* uconvert - convert string representations of decimal numbers into whole
number/fractional value pairs. */
-/* Copyright (C) 2008,2009,2020 Free Software Foundation, Inc.
+/* Copyright (C) 2008,2009,2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -57,10 +57,7 @@ static int multiplier[7] = { 1, 100000, 10000, 1000, 100, 10, 1 };
Return 1 if value converted; 0 if invalid integer for either whole or
fractional parts. */
int
-uconvert(s, ip, up, ep)
- char *s;
- long *ip, *up;
- char **ep;
+uconvert(char *s, long *ip, long *up, char **ep)
{
int n, mult;
long ipart, upart;
diff --git a/lib/sh/ufuncs.c b/lib/sh/ufuncs.c
index 03243918..ebdae226 100644
--- a/lib/sh/ufuncs.c
+++ b/lib/sh/ufuncs.c
@@ -45,8 +45,7 @@ extern int errno;
#if defined (HAVE_SETITIMER)
unsigned int
-falarm(secs, usecs)
- unsigned int secs, usecs;
+falarm(unsigned int secs, unsigned int usecs)
{
struct itimerval it, oit;
@@ -66,8 +65,7 @@ falarm(secs, usecs)
}
#else
int
-falarm (secs, usecs)
- unsigned int secs, usecs;
+falarm (unsigned int secs, unsigned int usecs)
{
if (secs == 0 && usecs == 0)
return (alarm (0));
@@ -86,8 +84,7 @@ falarm (secs, usecs)
#if defined (HAVE_TIMEVAL) && (defined (HAVE_SELECT) || defined (HAVE_PSELECT))
int
-fsleep(sec, usec)
- unsigned int sec, usec;
+fsleep(unsigned int sec, unsigned int usec)
{
int e, r;
sigset_t blocked_sigs, prevmask;
@@ -131,8 +128,7 @@ fsleep(sec, usec)
}
#else /* !HAVE_TIMEVAL || !HAVE_SELECT */
int
-fsleep(sec, usec)
- long sec, usec;
+fsleep(unsigned int sec, unsigned int usec)
{
if (usec >= 500000) /* round */
sec++;
diff --git a/lib/sh/unicode.c b/lib/sh/unicode.c
index d781353b..24d3d50d 100644
--- a/lib/sh/unicode.c
+++ b/lib/sh/unicode.c
@@ -1,6 +1,6 @@
/* unicode.c - functions to convert unicode characters */
-/* Copyright (C) 2010-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -50,9 +50,9 @@
#endif /* !STREQ */
#if defined (HAVE_LOCALE_CHARSET)
-extern const char *locale_charset PARAMS((void));
+extern const char *locale_charset (void);
#else
-extern char *get_locale_var PARAMS((char *));
+extern char *get_locale_var (char *);
#endif
extern int locale_utf8locale;
@@ -67,7 +67,7 @@ static iconv_t localconv;
static char charsetbuf[40];
static char *
-stub_charset ()
+stub_charset (void)
{
char *locale, *s, *t;
@@ -94,7 +94,7 @@ stub_charset ()
#endif
void
-u32reset ()
+u32reset (void)
{
#if defined (HAVE_ICONV)
if (u32init && localconv != (iconv_t)-1)
@@ -109,9 +109,7 @@ u32reset ()
/* u32toascii ? */
int
-u32tochar (x, s)
- unsigned long x;
- char *s;
+u32tochar (unsigned long x, char *s)
{
int l;
@@ -136,9 +134,7 @@ u32tochar (x, s)
}
int
-u32tocesc (wc, s)
- u_bits32_t wc;
- char *s;
+u32tocesc (u_bits32_t wc, char *s)
{
int l;
@@ -151,9 +147,7 @@ u32tocesc (wc, s)
/* Convert unsigned 32-bit int to utf-8 character string */
int
-u32toutf8 (wc, s)
- u_bits32_t wc;
- char *s;
+u32toutf8 (u_bits32_t wc, char *s)
{
int l;
@@ -214,9 +208,7 @@ u32toutf8 (wc, s)
/* Convert a 32-bit unsigned int (unicode) to a UTF-16 string. Rarely used,
only if sizeof(wchar_t) == 2. */
int
-u32toutf16 (c, s)
- u_bits32_t c;
- wchar_t *s;
+u32toutf16 (u_bits32_t c, wchar_t *s)
{
int l;
@@ -240,9 +232,7 @@ u32toutf16 (c, s)
/* convert a single unicode-32 character into a multibyte string and put the
result in S, which must be large enough (at least max(10,MB_LEN_MAX) bytes) */
int
-u32cconv (c, s)
- unsigned long c;
- char *s;
+u32cconv (unsigned long c, char *s)
{
wchar_t wc;
wchar_t ws[3];
@@ -333,7 +323,7 @@ u32cconv (c, s)
}
#else
void
-u32reset ()
+u32reset (void)
{
}
#endif /* HANDLE_MULTIBYTE */
diff --git a/lib/sh/utf8.c b/lib/sh/utf8.c
index fed25226..f762b884 100644
--- a/lib/sh/utf8.c
+++ b/lib/sh/utf8.c
@@ -1,6 +1,6 @@
/* utf8.c - UTF-8 character handling functions */
-/* Copyright (C) 2018 Free Software Foundation, Inc.
+/* Copyright (C) 2018, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -33,24 +33,20 @@ extern int locale_utf8locale;
#if defined (HANDLE_MULTIBYTE)
char *
-utf8_mbschr (s, c)
- const char *s;
- int c;
+utf8_mbschr (const char *s, int c)
{
return strchr (s, c); /* for now */
}
int
-utf8_mbscmp (s1, s2)
- const char *s1, *s2;
+utf8_mbscmp (const char *s1, const char *s2)
{
/* Use the fact that the UTF-8 encoding preserves lexicographic order. */
return strcmp (s1, s2);
}
char *
-utf8_mbsmbchar (str)
- const char *str;
+utf8_mbsmbchar (const char *str)
{
register char *s;
@@ -61,10 +57,7 @@ utf8_mbsmbchar (str)
}
int
-utf8_mbsnlen(src, srclen, maxlen)
- const char *src;
- size_t srclen;
- int maxlen;
+utf8_mbsnlen(const char *src, size_t srclen, int maxlen)
{
register int sind, count;
@@ -78,9 +71,7 @@ utf8_mbsnlen(src, srclen, maxlen)
/* Adapted from GNU gnulib. Handles UTF-8 characters up to 4 bytes long */
int
-utf8_mblen (s, n)
- const char *s;
- size_t n;
+utf8_mblen (const char *s, size_t n)
{
unsigned char c, c1, c2, c3;
@@ -174,8 +165,7 @@ utf8_mblen (s, n)
/* We can optimize this if we know the locale is UTF-8, but needs to handle
malformed byte sequences. */
size_t
-utf8_mbstrlen(s)
- const char *s;
+utf8_mbstrlen (const char *s)
{
size_t clen, nc;
int mb_cur_max;
diff --git a/lib/sh/vprint.c b/lib/sh/vprint.c
index 567fba38..b4c09e89 100644
--- a/lib/sh/vprint.c
+++ b/lib/sh/vprint.c
@@ -40,10 +40,7 @@
#include <varargs.h>
int
-vfprintf (iop, fmt, ap)
- FILE *iop;
- char *fmt;
- va_list ap;
+vfprintf (FILE *iop, char *fmt, va_list ap)
{
int len;
char localbuf[BUFSIZ];
@@ -68,9 +65,7 @@ vfprintf (iop, fmt, ap)
* Ditto for vsprintf
*/
int
-vsprintf (str, fmt, ap)
- char *str, *fmt;
- va_list ap;
+vsprintf (char *str, char *fmt, va_list ap)
{
FILE f;
int len;
diff --git a/lib/sh/wcsdup.c b/lib/sh/wcsdup.c
index 62a3c864..a7a6ac53 100644
--- a/lib/sh/wcsdup.c
+++ b/lib/sh/wcsdup.c
@@ -1,6 +1,6 @@
/* wcsdup.c - duplicate wide character string */
-/* Copyright (C) 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2006,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -28,8 +28,7 @@
#include <xmalloc.h>
wchar_t *
-wcsdup (ws)
- const wchar_t *ws;
+wcsdup (const wchar_t *ws)
{
wchar_t *ret;
size_t len;
diff --git a/lib/sh/wcsnwidth.c b/lib/sh/wcsnwidth.c
index 9c7e7cc5..12197bde 100644
--- a/lib/sh/wcsnwidth.c
+++ b/lib/sh/wcsnwidth.c
@@ -1,7 +1,7 @@
/* wcsnwidth.c - compute display width of wide character string, up to max
specified width, return length. */
-/* Copyright (C) 2012 Free Software Foundation, Inc.
+/* Copyright (C) 2012,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -31,9 +31,7 @@
PWCS. If the display width exceeds MAX, return the number of wide chars
from PWCS required to display MAX characters on the screen. */
int
-wcsnwidth(pwcs, n, max)
- const wchar_t *pwcs;
- size_t n, max;
+wcsnwidth(const wchar_t *pwcs, size_t n, size_t max)
{
wchar_t wc, *ws;
int len, l;
diff --git a/lib/sh/wcswidth.c b/lib/sh/wcswidth.c
index 1a30d9fc..2465e575 100644
--- a/lib/sh/wcswidth.c
+++ b/lib/sh/wcswidth.c
@@ -1,6 +1,6 @@
/* wcswidth.c - compute display width of wide character string */
-/* Copyright (C) 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2010,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -27,9 +27,7 @@
#include <bashansi.h>
int
-wcswidth(pwcs, n)
- const wchar_t *pwcs;
- size_t n;
+wcswidth(const wchar_t *pwcs, size_t n)
{
wchar_t wc;
int len, l;
diff --git a/lib/sh/winsize.c b/lib/sh/winsize.c
index 846fcd58..42461c8f 100644
--- a/lib/sh/winsize.c
+++ b/lib/sh/winsize.c
@@ -1,6 +1,6 @@
/* winsize.c - handle window size changes and information. */
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -32,12 +32,6 @@
/* Try to find the definitions of `struct winsize' and TIOGCWINSZ */
-#if 0
-#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
-# include <sys/ioctl.h>
-#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
-#endif
-
#if defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
# include <termios.h>
#endif /* STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
@@ -73,14 +67,12 @@ extern int shell_tty;
extern int interactive_shell;
extern int no_line_editing;
extern int bash_readline_initialized;
-extern void rl_set_screen_size PARAMS((int, int));
+extern void rl_set_screen_size (int, int);
#endif
-extern void sh_set_lines_and_columns PARAMS((int, int));
+extern void sh_set_lines_and_columns (int, int);
void
-get_new_window_size (from_sig, rp, cp)
- int from_sig;
- int *rp, *cp;
+get_new_window_size (int from_sig, int *rp, int *cp)
{
#if defined (TIOCGWINSZ)
struct winsize win;
diff --git a/lib/sh/zcatfd.c b/lib/sh/zcatfd.c
index aa8199fd..fe7b2a23 100644
--- a/lib/sh/zcatfd.c
+++ b/lib/sh/zcatfd.c
@@ -1,6 +1,6 @@
/* zcatfd - copy contents of file descriptor to another */
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -38,15 +38,13 @@ extern int errno;
# define ZBUFSIZ 4096
#endif
-extern ssize_t zread PARAMS((int, char *, size_t));
-extern int zwrite PARAMS((int, char *, ssize_t));
+extern ssize_t zread (int, char *, size_t);
+extern int zwrite (int, char *, ssize_t);
/* Dump contents of file descriptor FD to OFD. FN is the filename for
error messages (not used right now). */
int
-zcatfd (fd, ofd, fn)
- int fd, ofd;
- char *fn;
+zcatfd (int fd, int ofd, char *fn)
{
ssize_t nr;
int rval;
diff --git a/lib/sh/zgetline.c b/lib/sh/zgetline.c
index 5e1ef724..fd33440c 100644
--- a/lib/sh/zgetline.c
+++ b/lib/sh/zgetline.c
@@ -1,7 +1,7 @@
/* zgetline - read a line of input from a specified file descriptor and return
a pointer to a newly-allocated buffer containing the data. */
-/* Copyright (C) 2008-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -34,13 +34,13 @@
extern int errno;
#endif
-extern ssize_t zread PARAMS((int, char *, size_t));
-extern ssize_t zreadc PARAMS((int, char *));
-extern ssize_t zreadintr PARAMS((int, char *, size_t));
-extern ssize_t zreadcintr PARAMS((int, char *));
+extern ssize_t zread (int, char *, size_t);
+extern ssize_t zreadc (int, char *);
+extern ssize_t zreadintr (int, char *, size_t);
+extern ssize_t zreadcintr (int, char *);
-typedef ssize_t breadfunc_t PARAMS((int, char *, size_t));
-typedef ssize_t creadfunc_t PARAMS((int, char *));
+typedef ssize_t breadfunc_t (int, char *, size_t);
+typedef ssize_t creadfunc_t (int, char *);
/* Initial memory allocation for automatic growing buffer in zreadlinec */
#define GET_LINE_INITIAL_ALLOCATION 16
@@ -61,12 +61,7 @@ typedef ssize_t creadfunc_t PARAMS((int, char *));
Returns number of bytes read or -1 on error. */
ssize_t
-zgetline (fd, lineptr, n, delim, unbuffered_read)
- int fd;
- char **lineptr;
- size_t *n;
- int delim;
- int unbuffered_read;
+zgetline (int fd, char **lineptr, size_t *n, int delim, int unbuffered_read)
{
int retval;
size_t nr;
diff --git a/lib/sh/zmapfd.c b/lib/sh/zmapfd.c
index 9ff50a47..f577a1b3 100644
--- a/lib/sh/zmapfd.c
+++ b/lib/sh/zmapfd.c
@@ -1,6 +1,6 @@
/* zmapfd - read contents of file descriptor into a newly-allocated buffer */
-/* Copyright (C) 2006-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -40,15 +40,12 @@ extern int errno;
# define ZBUFSIZ 4096
#endif
-extern ssize_t zread PARAMS((int, char *, size_t));
+extern ssize_t zread (int, char *, size_t);
/* Dump contents of file descriptor FD to *OSTR. FN is the filename for
error messages (not used right now). */
int
-zmapfd (fd, ostr, fn)
- int fd;
- char **ostr;
- char *fn;
+zmapfd (int fd, char **ostr, char *fn)
{
ssize_t nr;
int rval;
diff --git a/lib/sh/zread.c b/lib/sh/zread.c
index dafb7f60..acae1b5a 100644
--- a/lib/sh/zread.c
+++ b/lib/sh/zread.c
@@ -1,6 +1,6 @@
/* zread - read data from file descriptor into buffer with retries */
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -51,10 +51,7 @@ extern int read_builtin_timeout (int);
/* Read LEN bytes from FD into BUF. Retry the read on EINTR. Any other
error causes the loop to break. */
ssize_t
-zread (fd, buf, len)
- int fd;
- char *buf;
- size_t len;
+zread (int fd, char *buf, size_t len)
{
ssize_t r;
@@ -87,10 +84,7 @@ zread (fd, buf, len)
#define NUM_INTR 3
ssize_t
-zreadretry (fd, buf, len)
- int fd;
- char *buf;
- size_t len;
+zreadretry (int fd, char *buf, size_t len)
{
ssize_t r;
int nintr;
@@ -112,10 +106,7 @@ zreadretry (fd, buf, len)
/* Call read(2) and allow it to be interrupted. Just a stub for now. */
ssize_t
-zreadintr (fd, buf, len)
- int fd;
- char *buf;
- size_t len;
+zreadintr (int fd, char *buf, size_t len)
{
check_signals ();
return (read (fd, buf, len));
@@ -129,9 +120,7 @@ static char lbuf[ZBUFSIZ];
static size_t lind, lused;
ssize_t
-zreadc (fd, cp)
- int fd;
- char *cp;
+zreadc (int fd, char *cp)
{
ssize_t nr;
@@ -154,9 +143,7 @@ zreadc (fd, cp)
/* Don't mix calls to zreadc and zreadcintr in the same function, since they
use the same local buffer. */
ssize_t
-zreadcintr (fd, cp)
- int fd;
- char *cp;
+zreadcintr (int fd, char *cp)
{
ssize_t nr;
@@ -179,10 +166,7 @@ zreadcintr (fd, cp)
/* Like zreadc, but read a specified number of characters at a time. Used
for `read -N'. */
ssize_t
-zreadn (fd, cp, len)
- int fd;
- char *cp;
- size_t len;
+zreadn (int fd, char *cp, size_t len)
{
ssize_t nr;
@@ -205,7 +189,7 @@ zreadn (fd, cp, len)
}
void
-zreset ()
+zreset (void)
{
lind = lused = 0;
}
@@ -213,8 +197,7 @@ zreset ()
/* Sync the seek pointer for FD so that the kernel's idea of the last char
read is the last char returned by zreadc. */
void
-zsyncfd (fd)
- int fd;
+zsyncfd (int fd)
{
off_t off, r;
diff --git a/lib/sh/zwrite.c b/lib/sh/zwrite.c
index 3240f4f4..54acc651 100644
--- a/lib/sh/zwrite.c
+++ b/lib/sh/zwrite.c
@@ -1,6 +1,6 @@
/* zwrite - write contents of buffer to file descriptor, retrying on error */
-/* Copyright (C) 1999-2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2002, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -36,10 +36,7 @@ extern int errno;
it is interrupted. We retry three times if we get a zero-length
write. Any other signal causes this function to return prematurely. */
int
-zwrite (fd, buf, nb)
- int fd;
- char *buf;
- size_t nb;
+zwrite (int fd, char *buf, size_t nb)
{
int n, i, nt;