- specify the valid format characters as a subset of what printf(3)
specifies, note that the %n format specifier takes a variable name
as an argument. Suggestion from Emanuele Torre <torreemanuele6@gmail.com>
+
+ 12/28
+ -----
+{xmalloc,variables,unwind_prot,trap,test,subst,sig,siglist,shell,redir,
+pcomplete,pathexp,make_cmd,mailcheck,jobs,input,hashcmd,hashlib,general,
+flags,findcmd,externs,execute_cmd,error,dispose_cmd,command,bashline,
+bashhist,assoc,arrayfunc,array,alias}.h
+{version,version2}.c
+ - PARAMS: remove for ANSI C-ification
+
+builtins/{getopt,common,bashgetopt}.h
+builtins/{mkbuiltins,gen-helpfiles,psize,psize-posix}.c
+builtins/{evalstring,bashgetopt,common,evalfile,getopt}.c
+builtins{alias,bind,break,cd,command,complete,declare,enable,exit,fc,
+fg_bg,getopts,hash,help,history,jobs,kill,mapfile,printf,pushd,read,set,
+shopt,source,suspend,trap,type,ulimit,umask,wait}.def
+ - PARAMS: remove for ANSI C-ification
+
+lib/malloc/{watch,table,shmalloc,mstats,imalloc}.h
+lib/malloc/{malloc,stats,table,trace}.c
+ - PARAMS: remove for ANSI C-ification
+
+lib/glob/{glob,strmatch}.h
+lib/glob/{glob,glob_loop,gmisc,sm_loop,smatch,strmatch,xmbsrtowcs}.c
+ - PARAMS: remove for ANSI C-ification
+
+lib/intl/{eval-plural,plural-exp,loadinfo,hash-string,gettextP}.h,
+lib/intl{plural.y,plural.c},
+lib/intl/{finddomain,bindtextdom,dcigettext,l10nflist,loadmsgcat,localealias,plural-exp}.c
+ - PARAMS: remove for ANSI C-ification
+ - STATIC -> static
+ - internal_function -> inline
+
+lib/sh/{casemod,clock,eaccess,fnxform,fpurge,makepath,mktime,netopen,pathphys,random,shquote,snprintf,spell,strtod,strtoimax,strtoumax,times,timeval,tmpfile,unicode,winsize,zcatfd,zgetline,zmapfd}.c
+ - PARAMS: remove for ANSI C-ification
+
+support/{bashversion.c,mkversion.sh,mksignames.c}
+ - PARAMS: remove for ANSI C-ification
+
+lib/sh/{clock,strchrnul,getcwd,times,rename,inet_aton,strdup,strerror,strnlen
+strpbrk,strtod,strtoimax,strtol,strtoumax,wcsdup,wcsnwidth,wcswidth,strcasecmp,
+strcasestr}.c
+ - C89-style function declarations
+
+lib/malloc/{alloca,malloc,stats,table,trace,xmalloc}.c
+ - C89-style function declarations
+
+ 12/29
+ -----
+lib/glob/{glob,glob_loop,gmisc,sm_loop,smatch,strmatch,xmbsrtowcs}.c
+ - C89-style function declarations
+
+lib/sh/{zcatfd,zgetline,zmapfd,zread,zwrite,winsize,vprint,uconvert,ufuncs,
+unicode,utf8}.c
+lib/sh/{stringlist,stringvec,strtrans,strvis,timeval,tmpfile}.c
+lib/sh/{setlinebuf,shmatch,shmbchar,shquote,shtty,snprintf,spell}.c
+lib/sh/{random,pathcanon,pathphys,oslib,netconn,netopen}.c
+lib/sh/{mailstat,makepath,mbscasecmp,mbschr,mbscmp,mktime}.c
+lib/sh/{input_avail,itos,getenv,fmtulong,fnxform,eaccess,dprintf,casemod,clktck}.c
+ - C89-style function declarations
+
+examples/loadables/{accept,asort,basename,bcat,cat,csv,cut,dirname,dsv}.c
+examples/loadables/{fdflags,finfo,head,hello,id,lcut,ln}.c
+examples/loadables/{mkdir,mkfifo,mktemp,mypid,necho,pathchk}.c
+examples/loadables/{print,printenv,push,realpath,rm,rmdir,seq}.c
+examples/loadables/{setpgid,stat,strftime,sync,tee,template,truefalse,tty}.c
+examples/loadables/{uname,unlink,whoami}.c
+ - C89-style function declarations
+
+xmalloc.c, array2.c, list.c, dispose_cmd.c, copy_cmd.c, bracecomp.c, mksyntax.c
+ - PARAMS: remove for ANSI C-ification
+ - C89-style function declarations
/* alias.h -- structure definitions. */
-/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* The list of known aliases. */
extern HASH_TABLE *aliases;
-extern void initialize_aliases PARAMS((void));
+extern void initialize_aliases (void);
/* Scan the list of aliases looking for one with NAME. Return NULL
if the alias doesn't exist, else a pointer to the alias. */
-extern alias_t *find_alias PARAMS((char *));
+extern alias_t *find_alias (char *);
/* Return the value of the alias for NAME, or NULL if there is none. */
-extern char *get_alias_value PARAMS((char *));
+extern char *get_alias_value (char *);
/* Make a new alias from NAME and VALUE. If NAME can be found,
then replace its value. */
-extern void add_alias PARAMS((char *, char *));
+extern void add_alias (char *, char *);
/* Remove the alias with name NAME from the alias list. Returns
the index of the removed alias, or -1 if the alias didn't exist. */
-extern int remove_alias PARAMS((char *));
+extern int remove_alias (char *);
/* Remove all aliases. */
-extern void delete_all_aliases PARAMS((void));
+extern void delete_all_aliases (void);
/* Return an array of all defined aliases. */
-extern alias_t **all_aliases PARAMS((void));
+extern alias_t **all_aliases (void);
/* Expand a single word for aliases. */
-extern char *alias_expand_word PARAMS((char *));
+extern char *alias_expand_word (char *);
/* Return a new line, with any aliases expanded. */
-extern char *alias_expand PARAMS((char *));
+extern char *alias_expand (char *);
/* Helper definition for the parser */
-extern void clear_string_list_expander PARAMS((alias_t *));
+extern void clear_string_list_expander (alias_t *);
#endif /* _ALIAS_H_ */
/* array.h -- definitions for the interface exported by array.c that allows
the rest of the shell to manipulate array variables. */
-/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define ARRAY_DEFAULT_SIZE 1024
-typedef int sh_ae_map_func_t PARAMS((ARRAY_ELEMENT *, void *));
+typedef int sh_ae_map_func_t (ARRAY_ELEMENT *, void *);
/* Basic operations on entire arrays */
#ifdef ALT_ARRAY_IMPLEMENTATION
-extern void array_alloc PARAMS((ARRAY *, arrayind_t));
-extern void array_resize PARAMS((ARRAY *, arrayind_t));
-extern void array_expand PARAMS((ARRAY *, arrayind_t));
-extern void array_dispose_elements PARAMS((ARRAY_ELEMENT **));
+extern void array_alloc (ARRAY *, arrayind_t);
+extern void array_resize (ARRAY *, arrayind_t);
+extern void array_expand (ARRAY *, arrayind_t);
+extern void array_dispose_elements (ARRAY_ELEMENT **);
#endif
-extern ARRAY *array_create PARAMS((void));
-extern void array_flush PARAMS((ARRAY *));
-extern void array_dispose PARAMS((ARRAY *));
-extern ARRAY *array_copy PARAMS((ARRAY *));
+extern ARRAY *array_create (void);
+extern void array_flush (ARRAY *);
+extern void array_dispose (ARRAY *);
+extern ARRAY *array_copy (ARRAY *);
#ifndef ALT_ARRAY_IMPLEMENTATION
-extern ARRAY *array_slice PARAMS((ARRAY *, ARRAY_ELEMENT *, ARRAY_ELEMENT *));
+extern ARRAY *array_slice (ARRAY *, ARRAY_ELEMENT *, ARRAY_ELEMENT *);
#else
-extern ARRAY *array_slice PARAMS((ARRAY *, arrayind_t, arrayind_t));
+extern ARRAY *array_slice (ARRAY *, arrayind_t, arrayind_t);
#endif
-extern void array_walk PARAMS((ARRAY *, sh_ae_map_func_t *, void *));
+extern void array_walk (ARRAY *, sh_ae_map_func_t *, void *);
#ifndef ALT_ARRAY_IMPLEMENTATION
-extern ARRAY_ELEMENT *array_shift PARAMS((ARRAY *, int, int));
+extern ARRAY_ELEMENT *array_shift (ARRAY *, int, int);
#else
-extern ARRAY_ELEMENT **array_shift PARAMS((ARRAY *, int, int));
+extern ARRAY_ELEMENT **array_shift (ARRAY *, int, int);
#endif
-extern int array_rshift PARAMS((ARRAY *, int, char *));
-extern ARRAY_ELEMENT *array_unshift_element PARAMS((ARRAY *));
-extern int array_shift_element PARAMS((ARRAY *, char *));
+extern int array_rshift (ARRAY *, int, char *);
+extern ARRAY_ELEMENT *array_unshift_element (ARRAY *);
+extern int array_shift_element (ARRAY *, char *);
-extern ARRAY *array_quote PARAMS((ARRAY *));
-extern ARRAY *array_quote_escapes PARAMS((ARRAY *));
-extern ARRAY *array_dequote PARAMS((ARRAY *));
-extern ARRAY *array_dequote_escapes PARAMS((ARRAY *));
-extern ARRAY *array_remove_quoted_nulls PARAMS((ARRAY *));
+extern ARRAY *array_quote (ARRAY *);
+extern ARRAY *array_quote_escapes (ARRAY *);
+extern ARRAY *array_dequote (ARRAY *);
+extern ARRAY *array_dequote_escapes (ARRAY *);
+extern ARRAY *array_remove_quoted_nulls (ARRAY *);
-extern char *array_subrange PARAMS((ARRAY *, arrayind_t, arrayind_t, int, int, int));
-extern char *array_patsub PARAMS((ARRAY *, char *, char *, int));
-extern char *array_modcase PARAMS((ARRAY *, char *, int, int));
+extern char *array_subrange (ARRAY *, arrayind_t, arrayind_t, int, int, int);
+extern char *array_patsub (ARRAY *, char *, char *, int);
+extern char *array_modcase (ARRAY *, char *, int, int);
/* Basic operations on array elements. */
-extern ARRAY_ELEMENT *array_create_element PARAMS((arrayind_t, char *));
-extern ARRAY_ELEMENT *array_copy_element PARAMS((ARRAY_ELEMENT *));
-extern void array_dispose_element PARAMS((ARRAY_ELEMENT *));
+extern ARRAY_ELEMENT *array_create_element (arrayind_t, char *);
+extern ARRAY_ELEMENT *array_copy_element (ARRAY_ELEMENT *);
+extern void array_dispose_element (ARRAY_ELEMENT *);
-extern int array_insert PARAMS((ARRAY *, arrayind_t, char *));
-extern ARRAY_ELEMENT *array_remove PARAMS((ARRAY *, arrayind_t));
-extern char *array_reference PARAMS((ARRAY *, arrayind_t));
+extern int array_insert (ARRAY *, arrayind_t, char *);
+extern ARRAY_ELEMENT *array_remove (ARRAY *, arrayind_t);
+extern char *array_reference (ARRAY *, arrayind_t);
/* Converting to and from arrays */
-extern WORD_LIST *array_to_word_list PARAMS((ARRAY *));
-extern ARRAY *array_from_word_list PARAMS((WORD_LIST *));
-extern WORD_LIST *array_keys_to_word_list PARAMS((ARRAY *));
-extern WORD_LIST *array_to_kvpair_list PARAMS((ARRAY *));
+extern WORD_LIST *array_to_word_list (ARRAY *);
+extern ARRAY *array_from_word_list (WORD_LIST *);
+extern WORD_LIST *array_keys_to_word_list (ARRAY *);
+extern WORD_LIST *array_to_kvpair_list (ARRAY *);
-extern ARRAY *array_assign_list PARAMS((ARRAY *, WORD_LIST *));
+extern ARRAY *array_assign_list (ARRAY *, WORD_LIST *);
-extern char **array_to_argv PARAMS((ARRAY *, int *));
-extern ARRAY *array_from_argv PARAMS((ARRAY *, char **, int));
+extern char **array_to_argv (ARRAY *, int *);
+extern ARRAY *array_from_argv (ARRAY *, char **, int);
-extern char *array_to_kvpair PARAMS((ARRAY *, int));
-extern char *array_to_assign PARAMS((ARRAY *, int));
-extern char *array_to_string PARAMS((ARRAY *, char *, int));
-extern ARRAY *array_from_string PARAMS((char *, char *));
+extern char *array_to_kvpair (ARRAY *, int);
+extern char *array_to_assign (ARRAY *, int);
+extern char *array_to_string (ARRAY *, char *, int);
+extern ARRAY *array_from_string (char *, char *);
/* Flags for array_shift */
#define AS_DISPOSE 0x01
#define element_forw(ae) ((ae)->next)
#define element_back(ae) ((ae)->prev)
#else
-extern arrayind_t element_forw PARAMS((ARRAY *, arrayind_t));
-extern arrayind_t element_back PARAMS((ARRAY *, arrayind_t));
+extern arrayind_t element_forw (ARRAY *, arrayind_t);
+extern arrayind_t element_back (ARRAY *, arrayind_t);
#endif
#define ALL_ELEMENT_SUB(c) ((c) == '@' || (c) == '*')
/* In eval.c, but uses ARRAY * */
-extern int execute_array_command PARAMS((ARRAY *, void *));
+extern int execute_array_command (ARRAY *, void *);
#endif /* _ARRAY_H_ */
* chet@ins.cwru.edu
*/
-/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2021,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define ARRAY_MAX_DOUBLE 16777216
-static ARRAY_ELEMENT **array_copy_elements PARAMS((ARRAY *));
-static char *array_to_string_internal PARAMS((ARRAY *, arrayind_t, arrayind_t, char *, int));
+static ARRAY_ELEMENT **array_copy_elements (ARRAY *);
+static char *array_to_string_internal (ARRAY *, arrayind_t, arrayind_t, char *, int);
static char *spacesep = " ";
void
-array_alloc (a, n)
-ARRAY *a;
-arrayind_t n;
+array_alloc (ARRAY *a, arrayind_t n)
{
arrayind_t i;
}
void
-array_resize (a, n)
-ARRAY *a;
-arrayind_t n;
+array_resize (ARRAY *a, arrayind_t n)
{
ARRAY_ELEMENT **e, *ae;
arrayind_t i, nsize;
}
void
-array_expand (a, n)
-ARRAY *a;
-arrayind_t n;
+array_expand (ARRAY *a, arrayind_t n)
{
arrayind_t nsize;
}
ARRAY *
-array_create()
+array_create(void)
{
ARRAY *r;
}
void
-array_flush (a)
-ARRAY *a;
+array_flush (ARRAY *a)
{
int r;
}
void
-array_dispose_elements(elist)
-ARRAY_ELEMENT **elist;
+array_dispose_elements(ARRAY_ELEMENT **elist)
{
arrayind_t i;
}
void
-array_dispose(a)
-ARRAY *a;
+array_dispose(ARRAY *a)
{
if (a == 0)
return;
}
static ARRAY_ELEMENT **
-array_copy_elements (a)
-ARRAY *a;
+array_copy_elements (ARRAY *a)
{
ARRAY_ELEMENT **ret;
arrayind_t i;
}
ARRAY *
-array_copy(a)
-ARRAY *a;
+array_copy(ARRAY *a)
{
ARRAY *a1;
* S to E, inclusive. The callers do the bounds checking.
*/
ARRAY *
-array_slice(array, s, e)
-ARRAY *array;
-arrayind_t s, e;
+array_slice(ARRAY *array, arrayind_t s, arrayind_t e)
{
ARRAY *a;
ARRAY_ELEMENT *p, *n;
* element as the argument.
*/
void
-array_walk(a, func, udata)
-ARRAY *a;
-sh_ae_map_func_t *func;
-void *udata;
+array_walk(ARRAY *a, sh_ae_map_func_t *func, void *udata)
{
arrayind_t i;
register ARRAY_ELEMENT *ae;
* returns NULL.
*/
ARRAY_ELEMENT **
-array_shift(a, n, flags)
-ARRAY *a;
-int n, flags;
+array_shift(ARRAY *a, int n, int flags)
{
ARRAY_ELEMENT **r, *ae;
register arrayind_t ni, ri;
* shift.
*/
int
-array_rshift (a, n, s)
-ARRAY *a;
-int n;
-char *s;
+array_rshift (ARRAY *a, int n, char *s)
{
register ARRAY_ELEMENT *ae, *new;
arrayind_t ni, nsize;
}
ARRAY_ELEMENT *
-array_unshift_element(a)
-ARRAY *a;
+array_unshift_element(ARRAY *a)
{
ARRAY_ELEMENT **r, *ret;
}
int
-array_shift_element(a, v)
-ARRAY *a;
-char *v;
+array_shift_element(ARRAY *a, char *v)
{
return (array_rshift (a, 1, v));
}
ARRAY *
-array_quote(array)
-ARRAY *array;
+array_quote(ARRAY *array)
{
register arrayind_t i;
ARRAY_ELEMENT *a;
}
ARRAY *
-array_quote_escapes(array)
-ARRAY *array;
+array_quote_escapes(ARRAY *array)
{
register arrayind_t i;
ARRAY_ELEMENT *a;
}
ARRAY *
-array_dequote(array)
-ARRAY *array;
+array_dequote(ARRAY *array)
{
register arrayind_t i;
ARRAY_ELEMENT *a;
}
ARRAY *
-array_dequote_escapes(array)
-ARRAY *array;
+array_dequote_escapes(ARRAY *array)
{
register arrayind_t i;
ARRAY_ELEMENT *a;
}
ARRAY *
-array_remove_quoted_nulls(array)
-ARRAY *array;
+array_remove_quoted_nulls(ARRAY *array)
{
register arrayind_t i;
ARRAY_ELEMENT *a;
* Since arrays are sparse, unset array elements are not counted.
*/
char *
-array_subrange (a, start, nelem, starsub, quoted, pflags)
-ARRAY *a;
-arrayind_t start, nelem;
-int starsub, quoted, pflags;
+array_subrange (ARRAY *a, arrayind_t start, arrayind_t nelem, int starsub, int quoted, int pflags)
{
ARRAY *a2;
arrayind_t s, e;
}
char *
-array_patsub (a, pat, rep, mflags)
-ARRAY *a;
-char *pat, *rep;
-int mflags;
+array_patsub (ARRAY *a, char *pat, char *rep, int mflags)
{
char *t;
int pchar, qflags, pflags;
}
char *
-array_modcase (a, pat, modop, mflags)
-ARRAY *a;
-char *pat;
-int modop;
-int mflags;
+array_modcase (ARRAY *a, char *pat, int modop, int mflags)
{
char *t;
int pchar, qflags, pflags;
* VALUE.
*/
ARRAY_ELEMENT *
-array_create_element(indx, value)
-arrayind_t indx;
-char *value;
+array_create_element(arrayind_t indx, char *value)
{
ARRAY_ELEMENT *r;
}
ARRAY_ELEMENT *
-array_copy_element(ae)
-ARRAY_ELEMENT *ae;
+array_copy_element(ARRAY_ELEMENT *ae)
{
return(ae ? array_create_element(element_index(ae), element_value(ae))
: (ARRAY_ELEMENT *) NULL);
}
void
-array_dispose_element(ae)
-ARRAY_ELEMENT *ae;
+array_dispose_element(ARRAY_ELEMENT *ae)
{
if (ae) {
FREE(ae->value);
* Add a new element with index I and value V to array A (a[i] = v).
*/
int
-array_insert(a, i, v)
-ARRAY *a;
-arrayind_t i;
-char *v;
+array_insert(ARRAY *a, arrayind_t i, char *v)
{
register ARRAY_ELEMENT *new, *old;
arrayind_t nsize;
* caller can dispose of it.
*/
ARRAY_ELEMENT *
-array_remove(a, i)
-ARRAY *a;
-arrayind_t i;
+array_remove(ARRAY *a, arrayind_t i)
{
register ARRAY_ELEMENT *ae;
arrayind_t ind;
* Return the value of a[i].
*/
char *
-array_reference(a, i)
-ARRAY *a;
-arrayind_t i;
+array_reference(ARRAY *a, arrayind_t i)
{
register ARRAY_ELEMENT *ae;
by the rest of the code. */
WORD_LIST *
-array_to_word_list(a)
-ARRAY *a;
+array_to_word_list(ARRAY *a)
{
register arrayind_t i;
WORD_LIST *list;
}
ARRAY *
-array_from_word_list (list)
-WORD_LIST *list;
+array_from_word_list (WORD_LIST *list)
{
ARRAY *a;
}
WORD_LIST *
-array_keys_to_word_list(a)
-ARRAY *a;
+array_keys_to_word_list(ARRAY *a)
{
arrayind_t ind;
WORD_LIST *list;
}
WORD_LIST *
-array_to_kvpair_list(a)
-ARRAY *a;
+array_to_kvpair_list (ARRAY *a)
{
arrayind_t ind;
WORD_LIST *list;
}
char **
-array_to_argv (a, countp)
-ARRAY *a;
-int *countp;
+array_to_argv (ARRAY *a, int *countp)
{
char **ret, *t;
int i;
}
ARRAY *
-array_from_argv(a, vec, count)
-ARRAY *a;
-char **vec;
-int count;
+array_from_argv(ARRAY *a, char **vec, int count)
{
arrayind_t i;
char *t;
* Return the next non-null array element after A[IND]
*/
arrayind_t
-element_forw(a, ind)
-ARRAY *a;
-arrayind_t ind;
+element_forw(ARRAY *a, arrayind_t ind)
{
register arrayind_t i;
* Return the previous non-null array element before A[IND]
*/
arrayind_t
-element_back (a, ind)
-ARRAY *a;
-arrayind_t ind;
+element_back (ARRAY *a, arrayind_t ind)
{
register arrayind_t i;
* to END, separated by SEP.
*/
static char *
-array_to_string_internal (a, start, end, sep, quoted)
-ARRAY *a;
-arrayind_t start, end;
-char *sep;
-int quoted;
+array_to_string_internal (ARRAY *a, arrayind_t start, arrayind_t end, char *sep, int quoted)
{
arrayind_t i;
char *result, *t;
}
char *
-array_to_kvpair (a, quoted)
-ARRAY *a;
-int quoted;
+array_to_kvpair (ARRAY *a, int quoted)
{
arrayind_t ind;
char *result, *valstr, *is;
}
char *
-array_to_assign (a, quoted)
-ARRAY *a;
-int quoted;
+array_to_assign (ARRAY *a, int quoted)
{
arrayind_t ind;
char *result, *valstr, *is;
}
char *
-array_to_string (a, sep, quoted)
-ARRAY *a;
-char *sep;
-int quoted;
+array_to_string (ARRAY *a, char *sep, int quoted)
{
if (a == 0)
return((char *)NULL);
* Return an array consisting of elements in S, separated by SEP
*/
ARRAY *
-array_from_string(s, sep)
-char *s, *sep;
+array_from_string(char *s, char *sep)
{
ARRAY *a;
WORD_LIST *w;
int interrupt_immediately = 0;
int
-signal_is_trapped(s)
-int s;
+signal_is_trapped(int s)
{
return 0;
}
}
WORD_DESC *
-make_bare_word (s)
-const char *s;
+make_bare_word (const char *s)
{
WORD_DESC *w;
}
WORD_LIST *
-make_word_list(x, l)
-WORD_DESC *x;
-WORD_LIST *l;
+make_word_list(WORD_DESC *x, WORD_LIST *l)
{
WORD_LIST *w;
}
WORD_LIST *
-list_string(s, t, i)
-char *s, *t;
-int i;
+list_string(char *s, char *t, int i)
{
char *r, *a;
WORD_LIST *wl;
}
GENERIC_LIST *
-list_reverse (list)
-GENERIC_LIST *list;
+list_reverse (GENERIC_LIST *list)
{
register GENERIC_LIST *next, *prev;
}
char *
-pat_subst(s, t, u, i)
-char *s, *t, *u;
-int i;
+pat_subst(char *s, char *t, char *u, int i)
{
return ((char *)NULL);
}
char *
-quote_string(s)
-char *s;
+quote_string(char *s)
{
return savestring(s);
}
-print_element(ae)
-ARRAY_ELEMENT *ae;
+print_element(ARRAY_ELEMENT *ae)
{
char lbuf[INT_STRLEN_BOUND (intmax_t) + 1];
element_value(ae));
}
-print_array(a)
-ARRAY *a;
+print_array(ARRAY *a)
{
printf("\n");
array_walk(a, print_element, (void *)NULL);
}
-main()
+main(int c, char **v)
{
ARRAY *a, *new_a, *copy_of_a;
ARRAY_ELEMENT *ae, *aew;
/* arrayfunc.h -- declarations for miscellaneous array functions in arrayfunc.c */
-/* 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.
#define VA_ONEWORD 0x002
#define VA_ALLOWALL 0x004 /* allow @ to mean all elements of the array */
-extern SHELL_VAR *convert_var_to_array PARAMS((SHELL_VAR *));
-extern SHELL_VAR *convert_var_to_assoc PARAMS((SHELL_VAR *));
+extern SHELL_VAR *convert_var_to_array (SHELL_VAR *);
+extern SHELL_VAR *convert_var_to_assoc (SHELL_VAR *);
-extern char *make_array_variable_value PARAMS((SHELL_VAR *, arrayind_t, char *, char *, int));
+extern char *make_array_variable_value (SHELL_VAR *, arrayind_t, char *, char *, int);
-extern SHELL_VAR *bind_array_variable PARAMS((char *, arrayind_t, char *, int));
-extern SHELL_VAR *bind_array_element PARAMS((SHELL_VAR *, arrayind_t, char *, int));
-extern SHELL_VAR *assign_array_element PARAMS((char *, char *, int, array_eltstate_t *));
+extern SHELL_VAR *bind_array_variable (char *, arrayind_t, char *, int);
+extern SHELL_VAR *bind_array_element (SHELL_VAR *, arrayind_t, char *, int);
+extern SHELL_VAR *assign_array_element (char *, char *, int, array_eltstate_t *);
-extern SHELL_VAR *bind_assoc_variable PARAMS((SHELL_VAR *, char *, char *, char *, int));
+extern SHELL_VAR *bind_assoc_variable (SHELL_VAR *, char *, char *, char *, int);
-extern SHELL_VAR *find_or_make_array_variable PARAMS((char *, int));
+extern SHELL_VAR *find_or_make_array_variable (char *, int);
-extern SHELL_VAR *assign_array_from_string PARAMS((char *, char *, int));
-extern SHELL_VAR *assign_array_var_from_word_list PARAMS((SHELL_VAR *, WORD_LIST *, int));
+extern SHELL_VAR *assign_array_from_string (char *, char *, int);
+extern SHELL_VAR *assign_array_var_from_word_list (SHELL_VAR *, WORD_LIST *, int);
-extern WORD_LIST *expand_compound_array_assignment PARAMS((SHELL_VAR *, char *, int));
-extern void assign_compound_array_list PARAMS((SHELL_VAR *, WORD_LIST *, int));
-extern SHELL_VAR *assign_array_var_from_string PARAMS((SHELL_VAR *, char *, int));
+extern WORD_LIST *expand_compound_array_assignment (SHELL_VAR *, char *, int);
+extern void assign_compound_array_list (SHELL_VAR *, WORD_LIST *, int);
+extern SHELL_VAR *assign_array_var_from_string (SHELL_VAR *, char *, int);
-extern char *expand_and_quote_assoc_word PARAMS((char *, int));
-extern void quote_compound_array_list PARAMS((WORD_LIST *, int));
+extern char *expand_and_quote_assoc_word (char *, int);
+extern void quote_compound_array_list (WORD_LIST *, int);
-extern int kvpair_assignment_p PARAMS((WORD_LIST *));
-extern char *expand_and_quote_kvpair_word PARAMS((char *));
+extern int kvpair_assignment_p (WORD_LIST *);
+extern char *expand_and_quote_kvpair_word (char *);
-extern int unbind_array_element PARAMS((SHELL_VAR *, char *, int));
-extern int skipsubscript PARAMS((const char *, int, int));
+extern int unbind_array_element (SHELL_VAR *, char *, int);
+extern int skipsubscript (const char *, int, int);
-extern void print_array_assignment PARAMS((SHELL_VAR *, int));
-extern void print_assoc_assignment PARAMS((SHELL_VAR *, int));
+extern void print_array_assignment (SHELL_VAR *, int);
+extern void print_assoc_assignment (SHELL_VAR *, int);
-extern arrayind_t array_expand_index PARAMS((SHELL_VAR *, char *, int, int));
-extern int valid_array_reference PARAMS((const char *, int));
-extern int tokenize_array_reference PARAMS((char *, int, char **));
+extern arrayind_t array_expand_index (SHELL_VAR *, char *, int, int);
+extern int valid_array_reference (const char *, int);
+extern int tokenize_array_reference (char *, int, char **);
-extern char *array_value PARAMS((const char *, int, int, array_eltstate_t *));
-extern char *get_array_value PARAMS((const char *, int, array_eltstate_t *));
+extern char *array_value (const char *, int, int, array_eltstate_t *);
+extern char *get_array_value (const char *, int, array_eltstate_t *);
-extern char *array_keys PARAMS((char *, int, int));
+extern char *array_keys (char *, int, int);
-extern char *array_variable_name PARAMS((const char *, int, char **, int *));
-extern SHELL_VAR *array_variable_part PARAMS((const char *, int, char **, int *));
+extern char *array_variable_name (const char *, int, char **, int *);
+extern SHELL_VAR *array_variable_part (const char *, int, char **, int *);
extern void init_eltstate (array_eltstate_t *);
extern void flush_eltstate (array_eltstate_t *);
#define assoc_walk(h, f) (hash_walk((h), (f))
-extern void assoc_dispose PARAMS((HASH_TABLE *));
-extern void assoc_flush PARAMS((HASH_TABLE *));
+extern void assoc_dispose (HASH_TABLE *);
+extern void assoc_flush (HASH_TABLE *);
-extern int assoc_insert PARAMS((HASH_TABLE *, char *, char *));
-extern PTR_T assoc_replace PARAMS((HASH_TABLE *, char *, char *));
-extern void assoc_remove PARAMS((HASH_TABLE *, char *));
+extern int assoc_insert (HASH_TABLE *, char *, char *);
+extern PTR_T assoc_replace (HASH_TABLE *, char *, char *);
+extern void assoc_remove (HASH_TABLE *, char *);
-extern char *assoc_reference PARAMS((HASH_TABLE *, char *));
+extern char *assoc_reference (HASH_TABLE *, char *);
-extern char *assoc_subrange PARAMS((HASH_TABLE *, arrayind_t, arrayind_t, int, int, int));
-extern char *assoc_patsub PARAMS((HASH_TABLE *, char *, char *, int));
-extern char *assoc_modcase PARAMS((HASH_TABLE *, char *, int, int));
+extern char *assoc_subrange (HASH_TABLE *, arrayind_t, arrayind_t, int, int, int);
+extern char *assoc_patsub (HASH_TABLE *, char *, char *, int);
+extern char *assoc_modcase (HASH_TABLE *, char *, int, int);
-extern HASH_TABLE *assoc_quote PARAMS((HASH_TABLE *));
-extern HASH_TABLE *assoc_quote_escapes PARAMS((HASH_TABLE *));
-extern HASH_TABLE *assoc_dequote PARAMS((HASH_TABLE *));
-extern HASH_TABLE *assoc_dequote_escapes PARAMS((HASH_TABLE *));
-extern HASH_TABLE *assoc_remove_quoted_nulls PARAMS((HASH_TABLE *));
+extern HASH_TABLE *assoc_quote (HASH_TABLE *);
+extern HASH_TABLE *assoc_quote_escapes (HASH_TABLE *);
+extern HASH_TABLE *assoc_dequote (HASH_TABLE *);
+extern HASH_TABLE *assoc_dequote_escapes (HASH_TABLE *);
+extern HASH_TABLE *assoc_remove_quoted_nulls (HASH_TABLE *);
-extern char *assoc_to_kvpair PARAMS((HASH_TABLE *, int));
-extern char *assoc_to_assign PARAMS((HASH_TABLE *, int));
+extern char *assoc_to_kvpair (HASH_TABLE *, int);
+extern char *assoc_to_assign (HASH_TABLE *, int);
-extern WORD_LIST *assoc_to_word_list PARAMS((HASH_TABLE *));
-extern WORD_LIST *assoc_keys_to_word_list PARAMS((HASH_TABLE *));
-extern WORD_LIST *assoc_to_kvpair_list PARAMS((HASH_TABLE *));
+extern WORD_LIST *assoc_to_word_list (HASH_TABLE *);
+extern WORD_LIST *assoc_keys_to_word_list (HASH_TABLE *);
+extern WORD_LIST *assoc_to_kvpair_list (HASH_TABLE *);
-extern char *assoc_to_string PARAMS((HASH_TABLE *, char *, int));
+extern char *assoc_to_string (HASH_TABLE *, char *, int);
#endif /* _ASSOC_H_ */
/* bashhist.h -- interface to the bash history functions in bashhist.c. */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int double_quotes_inhibit_history_expansion;
# endif /* BANG_HISTORY */
-extern void bash_initialize_history PARAMS((void));
-extern void bash_history_reinit PARAMS((int));
-extern void bash_history_disable PARAMS((void));
-extern void bash_history_enable PARAMS((void));
-extern void bash_clear_history PARAMS((void));
-extern int bash_delete_histent PARAMS((int));
-extern int bash_delete_history_range PARAMS((int, int));
-extern int bash_delete_last_history PARAMS((void));
-extern void load_history PARAMS((void));
-extern void save_history PARAMS((void));
-extern int maybe_append_history PARAMS((char *));
-extern int maybe_save_shell_history PARAMS((void));
-extern char *pre_process_line PARAMS((char *, int, int));
-extern void maybe_add_history PARAMS((char *));
-extern void bash_add_history PARAMS((char *));
-extern int check_add_history PARAMS((char *, int));
-extern int history_number PARAMS((void));
-
-extern void setup_history_ignore PARAMS((char *));
-
-extern char *last_history_line PARAMS((void));
+extern void bash_initialize_history (void);
+extern void bash_history_reinit (int);
+extern void bash_history_disable (void);
+extern void bash_history_enable (void);
+extern void bash_clear_history (void);
+extern int bash_delete_histent (int);
+extern int bash_delete_history_range (int, int);
+extern int bash_delete_last_history (void);
+extern void load_history (void);
+extern void save_history (void);
+extern int maybe_append_history (char *);
+extern int maybe_save_shell_history (void);
+extern char *pre_process_line (char *, int, int);
+extern void maybe_add_history (char *);
+extern void bash_add_history (char *);
+extern int check_add_history (char *, int);
+extern int history_number (void);
+
+extern void setup_history_ignore (char *);
+
+extern char *last_history_line (void);
#endif /* _BASHHIST_H_ */
/* bashline.h -- interface to the bash readline functions in bashline.c. */
-/* Copyright (C) 1993-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int dircomplete_expand_relpath;
extern int complete_fullquote;
-extern void posix_readline_initialize PARAMS((int));
-extern void reset_completer_word_break_chars PARAMS((void));
-extern int enable_hostname_completion PARAMS((int));
-extern void initialize_readline PARAMS((void));
-extern void bashline_reset PARAMS((void));
-extern void bashline_reinitialize PARAMS((void));
-extern int bash_re_edit PARAMS((char *));
+extern void posix_readline_initialize (int);
+extern void reset_completer_word_break_chars (void);
+extern int enable_hostname_completion (int);
+extern void initialize_readline (void);
+extern void bashline_reset (void);
+extern void bashline_reinitialize (void);
+extern int bash_re_edit (char *);
-extern void bashline_set_event_hook PARAMS((void));
-extern void bashline_reset_event_hook PARAMS((void));
+extern void bashline_set_event_hook (void);
+extern void bashline_reset_event_hook (void);
-extern int bind_keyseq_to_unix_command PARAMS((char *));
-extern int bash_execute_unix_command PARAMS((int, int));
-extern int print_unix_command_map PARAMS((void));
-extern int unbind_unix_command PARAMS((char *));
+extern int bind_keyseq_to_unix_command (char *);
+extern int bash_execute_unix_command (int, int);
+extern int print_unix_command_map (void);
+extern int unbind_unix_command (char *);
-extern char **bash_default_completion PARAMS((const char *, int, int, int, int));
+extern char **bash_default_completion (const char *, int, int, int, int);
-extern void set_directory_hook PARAMS((void));
+extern void set_directory_hook (void);
/* Used by programmable completion code. */
-extern char *command_word_completion_function PARAMS((const char *, int));
-extern char *bash_groupname_completion_function PARAMS((const char *, int));
-extern char *bash_servicename_completion_function PARAMS((const char *, int));
+extern char *command_word_completion_function (const char *, int);
+extern char *bash_groupname_completion_function (const char *, int);
+extern char *bash_servicename_completion_function (const char *, int);
-extern char **get_hostname_list PARAMS((void));
-extern void clear_hostname_list PARAMS((void));
+extern char **get_hostname_list (void);
+extern void clear_hostname_list (void);
-extern char **bash_directory_completion_matches PARAMS((const char *));
-extern char *bash_dequote_text PARAMS((const char *));
+extern char **bash_directory_completion_matches (const char *);
+extern char *bash_dequote_text (const char *);
#endif /* _BASHLINE_H_ */
/* Original version by tromey@cns.caltech.edu, Fri Feb 7 1992. */
-/* 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.
#include "shell.h"
#include <readline/readline.h>
-static int _strcompare PARAMS((char **, char **));
+static int _strcompare (const char **, const char **);
/* Find greatest common prefix of two strings. */
static int
-string_gcd (s1, s2)
- char *s1, *s2;
+string_gcd (char *s1, char *s2)
{
register int i;
}
static char *
-really_munge_braces (array, real_start, real_end, gcd_zero)
- char **array;
- int real_start, real_end, gcd_zero;
+really_munge_braces (char **array, int real_start, int real_end, int gcd_zero)
{
int start, end, gcd;
char *result, *subterm, *x;
}
static int
-_strcompare (s1, s2)
- char **s1, **s2;
+_strcompare (const char **s1, const char **s2)
{
int result;
}
static int
-hack_braces_completion (names)
- char **names;
+hack_braces_completion (char **names)
{
register int i;
char *temp;
/* We handle quoting ourselves within hack_braces_completion, so we turn off
rl_filename_quoting_desired and rl_filename_quoting_function. */
int
-bash_brace_completion (count, ignore)
- int count, ignore;
+bash_brace_completion (int count, int ignore)
{
rl_compignore_func_t *orig_ignore_func;
rl_compentry_func_t *orig_entry_func;
This file is alias.def, from which is created alias.c
It implements the builtins "alias" and "unalias" in Bash.
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Flags for print_alias */
#define AL_REUSABLE 0x01
-static void print_alias PARAMS((alias_t *, int));
+static void print_alias (alias_t *, int);
/* Hack the alias command in a Korn shell way. */
int
/* bashgetopt.c -- `getopt' for use by the builtins. */
-/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
WORD_LIST *loptend; /* Points to the first non-option argument in the list */
int
-internal_getopt(list, opts)
-WORD_LIST *list;
-char *opts;
+internal_getopt(WORD_LIST *list, char *opts)
{
register int c;
register char *cp;
*/
void
-reset_internal_getopt ()
+reset_internal_getopt (void)
{
lhead = lcurrent = loptend = (WORD_LIST *)NULL;
sp = 1;
/* bashgetopt.h -- extern declarations for stuff defined in bashgetopt.c. */
-/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern WORD_LIST *lcurrent;
extern WORD_LIST *loptend;
-extern int internal_getopt PARAMS((WORD_LIST *, char *));
-extern void reset_internal_getopt PARAMS((void));
+extern int internal_getopt (WORD_LIST *, char *);
+extern void reset_internal_getopt (void);
#endif /* !__BASH_GETOPT_H */
This file is bind.def, from which is created bind.c.
It implements the builtin "bind" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include "bashgetopt.h"
#include "common.h"
-static int query_bindings PARAMS((char *));
-static int unbind_command PARAMS((char *));
-static int unbind_keyseq PARAMS((char *));
+static int query_bindings (char *);
+static int unbind_command (char *);
+static int unbind_keyseq (char *);
#define BIND_RETURN(x) do { return_code = x; goto bind_exit; } while (0)
This file is break.def, from which is created break.c.
It implements the builtins "break" and "continue" in Bash.
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include "../execute_cmd.h"
#include "common.h"
-static int check_loop_level PARAMS((void));
+static int check_loop_level (void);
/* The depth of while's and until's. */
int loop_level = 0;
extern const char * const bash_getcwd_errstr;
-static int bindpwd PARAMS((int));
-static int setpwd PARAMS((char *));
-static char *resetpwd PARAMS((char *));
-static int change_to_directory PARAMS((char *, int, int));
+static int bindpwd (int);
+static int setpwd (char *);
+static char *resetpwd (char *);
+static int change_to_directory (char *, int, int);
-static int cdxattr PARAMS((char *, char **));
-static void resetxattr PARAMS((void));
+static int cdxattr (char *, char **);
+static void resetxattr (void);
/* Change this to 1 to get cd spelling correction by default. */
int cdspelling = 0;
This file is command.def, from which is created command.c.
It implements the builtin "command" in Bash.
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include "common.h"
#if defined (_CS_PATH) && defined (HAVE_CONFSTR) && !HAVE_DECL_CONFSTR
-extern size_t confstr PARAMS((int, char *, size_t));
+extern size_t confstr (int, char *, size_t);
#endif
/* Run the commands mentioned in LIST without paying attention to shell
/* common.c - utility functions for all builtins */
-/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
shell. */
static void
-builtin_error_prolog ()
+builtin_error_prolog (void)
{
char *name;
/* Print a usage summary for the currently-executing builtin command. */
void
-builtin_usage ()
+builtin_usage (void)
{
if (this_command_name && *this_command_name)
fprintf (stderr, _("%s: usage: "), this_command_name);
/* Return if LIST is NULL else barf and jump to top_level. Used by some
builtins that do not accept arguments. */
void
-no_args (list)
- WORD_LIST *list;
+no_args (WORD_LIST *list)
{
if (list)
{
/* Check that no options were given to the currently-executing builtin,
and return 0 if there were options. */
int
-no_options (list)
- WORD_LIST *list;
+no_options (WORD_LIST *list)
{
int opt;
}
void
-sh_needarg (s)
- char *s;
+sh_needarg (char *s)
{
builtin_error (_("%s: option requires an argument"), s);
}
void
-sh_neednumarg (s)
- char *s;
+sh_neednumarg (char *s)
{
builtin_error (_("%s: numeric argument required"), s);
}
void
-sh_notfound (s)
- char *s;
+sh_notfound (char *s)
{
builtin_error (_("%s: not found"), s);
}
/* Function called when one of the builtin commands detects an invalid
option. */
void
-sh_invalidopt (s)
- char *s;
+sh_invalidopt (char *s)
{
builtin_error (_("%s: invalid option"), s);
}
void
-sh_invalidoptname (s)
- char *s;
+sh_invalidoptname (char *s)
{
builtin_error (_("%s: invalid option name"), s);
}
void
-sh_invalidid (s)
- char *s;
+sh_invalidid (char *s)
{
builtin_error (_("`%s': not a valid identifier"), s);
}
void
-sh_invalidnum (s)
- char *s;
+sh_invalidnum (char *s)
{
char *msg;
}
void
-sh_invalidsig (s)
- char *s;
+sh_invalidsig (char *s)
{
builtin_error (_("%s: invalid signal specification"), s);
}
void
-sh_badpid (s)
- char *s;
+sh_badpid (char *s)
{
builtin_error (_("`%s': not a pid or valid job spec"), s);
}
void
-sh_readonly (s)
- const char *s;
+sh_readonly (const char *s)
{
builtin_error (_("%s: readonly variable"), s);
}
void
-sh_noassign (s)
- const char *s;
+sh_noassign (const char *s)
{
internal_error (_("%s: cannot assign"), s); /* XXX */
}
void
-sh_erange (s, desc)
- char *s, *desc;
+sh_erange (char *s, char *desc)
{
if (s)
builtin_error (_("%s: %s out of range"), s, desc ? desc : _("argument"));
#if defined (JOB_CONTROL)
void
-sh_badjob (s)
- char *s;
+sh_badjob (char *s)
{
builtin_error (_("%s: no such job"), s);
}
void
-sh_nojobs (s)
- char *s;
+sh_nojobs (char *s)
{
if (s)
builtin_error (_("%s: no job control"), s);
#if defined (RESTRICTED_SHELL)
void
-sh_restricted (s)
- char *s;
+sh_restricted (char *s)
{
if (s)
builtin_error (_("%s: restricted"), s);
#endif
void
-sh_notbuiltin (s)
- char *s;
+sh_notbuiltin (char *s)
{
builtin_error (_("%s: not a shell builtin"), s);
}
void
-sh_wrerror ()
+sh_wrerror (void)
{
#if defined (DONT_REPORT_BROKEN_PIPE_WRITE_ERRORS) && defined (EPIPE)
if (errno != EPIPE)
}
void
-sh_ttyerror (set)
- int set;
+sh_ttyerror (int set)
{
if (set)
builtin_error (_("error setting terminal attributes: %s"), strerror (errno));
}
int
-sh_chkwrite (s)
- int s;
+sh_chkwrite (int s)
{
QUIT;
fflush (stdout);
in the list in *IP, if IP is non-null. A convenience function for
loadable builtins; also used by `test'. */
char **
-make_builtin_argv (list, ip)
- WORD_LIST *list;
- int *ip;
+make_builtin_argv (WORD_LIST *list, int *ip)
{
char **argv;
only discard the ones that are to be replaced. Set POSPARAM_COUNT
to the number of args assigned (length of LIST). */
void
-remember_args (list, destructive)
- WORD_LIST *list;
- int destructive;
+remember_args (WORD_LIST *list, int destructive)
{
register int i;
}
void
-shift_args (times)
- int times;
+shift_args (int times)
{
WORD_LIST *temp;
int count;
}
int
-number_of_args ()
+number_of_args (void)
{
#if 0
register WORD_LIST *list;
/* Have the dollar variables been reset to new values since we last
checked? */
int
-dollar_vars_changed ()
+dollar_vars_changed (void)
{
return (changed_dollar_vars);
}
void
-set_dollar_vars_unchanged ()
+set_dollar_vars_unchanged (void)
{
changed_dollar_vars = 0;
}
void
-set_dollar_vars_changed ()
+set_dollar_vars_changed (void)
{
if (variable_context)
changed_dollar_vars |= ARGS_FUNC;
current command; if FATAL is 0, return an indication of an invalid
number by setting *NUMOK == 0 and return -1. */
int
-get_numeric_arg (list, fatal, count)
- WORD_LIST *list;
- int fatal;
- intmax_t *count;
+get_numeric_arg (WORD_LIST *list, int fatal, intmax_t *count)
{
char *arg;
/* Get an eight-bit status value from LIST */
int
-get_exitstat (list)
- WORD_LIST *list;
+get_exitstat (WORD_LIST *list)
{
int status;
intmax_t sval;
/* Return the octal number parsed from STRING, or -1 to indicate
that the string contained a bad number. */
int
-read_octal (string)
- char *string;
+read_octal (char *string)
{
int result, digits;
char *the_current_working_directory = (char *)NULL;
char *
-get_working_directory (for_whom)
- char *for_whom;
+get_working_directory (char *for_whom)
{
if (no_symbolic_links)
{
/* Make NAME our internal idea of the current working directory. */
void
-set_working_directory (name)
- char *name;
+set_working_directory (char *name)
{
FREE (the_current_working_directory);
the_current_working_directory = savestring (name);
#if defined (JOB_CONTROL)
int
-get_job_by_name (name, flags)
- const char *name;
- int flags;
+get_job_by_name (const char *name, int flags)
{
register int i, wl, cl, match, job;
register PROCESS *p;
/* Return the job spec found in LIST. */
int
-get_job_spec (list)
- WORD_LIST *list;
+get_job_spec (WORD_LIST *list)
{
register char *word;
int job, jflags;
* NOTE: `kill' calls this function with forcecols == 0
*/
int
-display_signal_list (list, forcecols)
- WORD_LIST *list;
- int forcecols;
+display_signal_list (WORD_LIST *list, int forcecols)
{
register int i, column;
char *name;
Return the address of the builtin.
DISABLED_OKAY means find it even if the builtin is disabled. */
struct builtin *
-builtin_address_internal (name, disabled_okay)
- char *name;
- int disabled_okay;
+builtin_address_internal (const char *name, int disabled_okay)
{
int hi, lo, mid, j;
/* Return the pointer to the function implementing builtin command NAME. */
sh_builtin_func_t *
-find_shell_builtin (name)
- char *name;
+find_shell_builtin (const char *name)
{
current_builtin = builtin_address_internal (name, 0);
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
/* Return the address of builtin with NAME, whether it is enabled or not. */
sh_builtin_func_t *
-builtin_address (name)
- char *name;
+builtin_address (const char *name)
{
current_builtin = builtin_address_internal (name, 1);
return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)NULL);
/* Return the function implementing the builtin NAME, but only if it is a
POSIX.2 special builtin. */
sh_builtin_func_t *
-find_special_builtin (name)
- char *name;
+find_special_builtin (const char *name)
{
current_builtin = builtin_address_internal (name, 0);
return ((current_builtin && (current_builtin->flags & SPECIAL_BUILTIN)) ?
}
static int
-shell_builtin_compare (sbp1, sbp2)
- struct builtin *sbp1, *sbp2;
+shell_builtin_compare (struct builtin *sbp1, struct builtin *sbp2)
{
int result;
/* Sort the table of shell builtins so that the binary search will work
in find_shell_builtin. */
void
-initialize_shell_builtins ()
+initialize_shell_builtins (void)
{
qsort (shell_builtins, num_shell_builtins, sizeof (struct builtin),
(QSFUNC *)shell_builtin_compare);
#if !defined (HELP_BUILTIN)
void
-builtin_help ()
+builtin_help (void)
{
printf ("%s: %s\n", this_command_name, _("help not available in this version"));
}
/* Assign NAME=VALUE, passing FLAGS to the assignment functions. */
SHELL_VAR *
-builtin_bind_variable (name, value, flags)
- char *name;
- char *value;
- int flags;
+builtin_bind_variable (char *name, char *value, int flags)
{
SHELL_VAR *v;
int vflags, bindflags;
}
SHELL_VAR *
-builtin_bind_var_to_int (name, val, flags)
- char *name;
- intmax_t val;
- int flags;
+builtin_bind_var_to_int (char *name, intmax_t val, int flags)
{
SHELL_VAR *v;
#if defined (ARRAY_VARS)
SHELL_VAR *
-builtin_find_indexed_array (array_name, flags)
- char *array_name;
- int flags;
+builtin_find_indexed_array (char *array_name, int flags)
{
SHELL_VAR *entry;
/* Like check_unbind_variable, but for use by builtins (only matters for
error messages). */
int
-builtin_unbind_variable (vname)
- const char *vname;
+builtin_unbind_variable (const char *vname)
{
SHELL_VAR *v;
}
int
-builtin_arrayref_flags (w, baseflags)
- WORD_DESC *w;
- int baseflags;
+builtin_arrayref_flags (WORD_DESC *w, int baseflags)
{
char *t;
int vflags;
#if defined (ARRAY_VARS)
int
-set_expand_once (nval, uwp)
- int nval, uwp;
+set_expand_once (int nval, int uwp)
{
int oa;
#define MAX_ATTRIBUTES 16
/* Functions from common.c */
-extern void builtin_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
-extern void builtin_warning PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
-extern void builtin_usage PARAMS((void));
-extern void no_args PARAMS((WORD_LIST *));
-extern int no_options PARAMS((WORD_LIST *));
+extern void builtin_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
+extern void builtin_warning (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
+extern void builtin_usage (void);
+extern void no_args (WORD_LIST *);
+extern int no_options (WORD_LIST *);
/* common error message functions */
-extern void sh_needarg PARAMS((char *));
-extern void sh_neednumarg PARAMS((char *));
-extern void sh_notfound PARAMS((char *));
-extern void sh_invalidopt PARAMS((char *));
-extern void sh_invalidoptname PARAMS((char *));
-extern void sh_invalidid PARAMS((char *));
-extern void sh_invalidnum PARAMS((char *));
-extern void sh_invalidsig PARAMS((char *));
-extern void sh_readonly PARAMS((const char *));
-extern void sh_noassign PARAMS((const char *));
-extern void sh_erange PARAMS((char *, char *));
-extern void sh_badpid PARAMS((char *));
-extern void sh_badjob PARAMS((char *));
-extern void sh_nojobs PARAMS((char *));
-extern void sh_restricted PARAMS((char *));
-extern void sh_notbuiltin PARAMS((char *));
-extern void sh_wrerror PARAMS((void));
-extern void sh_ttyerror PARAMS((int));
-extern int sh_chkwrite PARAMS((int));
-
-extern char **make_builtin_argv PARAMS((WORD_LIST *, int *));
-extern void remember_args PARAMS((WORD_LIST *, int));
-extern void shift_args PARAMS((int));
-extern int number_of_args PARAMS((void));
-
-extern int dollar_vars_changed PARAMS((void));
-extern void set_dollar_vars_unchanged PARAMS((void));
-extern void set_dollar_vars_changed PARAMS((void));
-
-extern int get_numeric_arg PARAMS((WORD_LIST *, int, intmax_t *));
-extern int get_exitstat PARAMS((WORD_LIST *));
-extern int read_octal PARAMS((char *));
+extern void sh_needarg (char *);
+extern void sh_neednumarg (char *);
+extern void sh_notfound (char *);
+extern void sh_invalidopt (char *);
+extern void sh_invalidoptname (char *);
+extern void sh_invalidid (char *);
+extern void sh_invalidnum (char *);
+extern void sh_invalidsig (char *);
+extern void sh_readonly (const char *);
+extern void sh_noassign (const char *);
+extern void sh_erange (char *, char *);
+extern void sh_badpid (char *);
+extern void sh_badjob (char *);
+extern void sh_nojobs (char *);
+extern void sh_restricted (char *);
+extern void sh_notbuiltin (char *);
+extern void sh_wrerror (void);
+extern void sh_ttyerror (int);
+extern int sh_chkwrite (int);
+
+extern char **make_builtin_argv (WORD_LIST *, int *);
+extern void remember_args (WORD_LIST *, int);
+extern void shift_args (int);
+extern int number_of_args (void);
+
+extern int dollar_vars_changed (void);
+extern void set_dollar_vars_unchanged (void);
+extern void set_dollar_vars_changed (void);
+
+extern int get_numeric_arg (WORD_LIST *, int, intmax_t *);
+extern int get_exitstat (WORD_LIST *);
+extern int read_octal (char *);
/* Keeps track of the current working directory. */
extern char *the_current_working_directory;
-extern char *get_working_directory PARAMS((char *));
-extern void set_working_directory PARAMS((char *));
+extern char *get_working_directory (char *);
+extern void set_working_directory (char *);
#if defined (JOB_CONTROL)
-extern int get_job_by_name PARAMS((const char *, int));
-extern int get_job_spec PARAMS((WORD_LIST *));
+extern int get_job_by_name (const char *, int);
+extern int get_job_spec (WORD_LIST *);
#endif
-extern int display_signal_list PARAMS((WORD_LIST *, int));
+extern int display_signal_list (WORD_LIST *, int);
/* It's OK to declare a function as returning a Function * without
providing a definition of what a `Function' is. */
-extern struct builtin *builtin_address_internal PARAMS((char *, int));
-extern sh_builtin_func_t *find_shell_builtin PARAMS((char *));
-extern sh_builtin_func_t *builtin_address PARAMS((char *));
-extern sh_builtin_func_t *find_special_builtin PARAMS((char *));
-extern void initialize_shell_builtins PARAMS((void));
+extern struct builtin *builtin_address_internal (const char *, int);
+extern sh_builtin_func_t *find_shell_builtin (const char *);
+extern sh_builtin_func_t *builtin_address (const char *);
+extern sh_builtin_func_t *find_special_builtin (const char *);
+extern void initialize_shell_builtins (void);
#if defined (ARRAY_VARS)
-extern int set_expand_once PARAMS((int, int));
+extern int set_expand_once (int, int);
#endif
/* Functions from exit.def */
-extern void bash_logout PARAMS((void));
+extern void bash_logout (void);
/* Functions from getopts.def */
-extern void getopts_reset PARAMS((int));
+extern void getopts_reset (int);
/* Functions from help.def */
-extern void builtin_help PARAMS((void));
+extern void builtin_help (void);
/* Functions from read.def */
-extern void read_tty_cleanup PARAMS((void));
-extern int read_tty_modified PARAMS((void));
+extern void read_tty_cleanup (void);
+extern int read_tty_modified (void);
-extern int read_builtin_timeout PARAMS((int));
-extern void check_read_timeout PARAMS((void));
+extern int read_builtin_timeout (int);
+extern void check_read_timeout (void);
/* Functions from set.def */
-extern int minus_o_option_value PARAMS((char *));
-extern void list_minus_o_opts PARAMS((int, int));
-extern char **get_minus_o_opts PARAMS((void));
-extern int set_minus_o_option PARAMS((int, char *));
+extern int minus_o_option_value (char *);
+extern void list_minus_o_opts (int, int);
+extern char **get_minus_o_opts (void);
+extern int set_minus_o_option (int, char *);
-extern void set_shellopts PARAMS((void));
-extern void parse_shellopts PARAMS((char *));
-extern void initialize_shell_options PARAMS((int));
+extern void set_shellopts (void);
+extern void parse_shellopts (char *);
+extern void initialize_shell_options (int);
-extern void reset_shell_options PARAMS((void));
+extern void reset_shell_options (void);
-extern char *get_current_options PARAMS((void));
-extern void set_current_options PARAMS((const char *));
+extern char *get_current_options (void);
+extern void set_current_options (const char *);
/* Functions from shopt.def */
-extern void reset_shopt_options PARAMS((void));
-extern char **get_shopt_options PARAMS((void));
+extern void reset_shopt_options (void);
+extern char **get_shopt_options (void);
-extern int shopt_setopt PARAMS((char *, int));
-extern int shopt_listopt PARAMS((char *, int));
+extern int shopt_setopt (char *, int);
+extern int shopt_listopt (char *, int);
-extern int set_login_shell PARAMS((char *, int));
+extern int set_login_shell (char *, int);
-extern void set_bashopts PARAMS((void));
-extern void parse_bashopts PARAMS((char *));
-extern void initialize_bashopts PARAMS((int));
+extern void set_bashopts (void);
+extern void parse_bashopts (char *);
+extern void initialize_bashopts (int);
-extern void set_compatibility_opts PARAMS((void));
+extern void set_compatibility_opts (void);
/* Functions from type.def */
-extern int describe_command PARAMS((char *, int));
+extern int describe_command (char *, int);
/* Functions from setattr.def */
-extern int set_or_show_attributes PARAMS((WORD_LIST *, int, int));
-extern int show_all_var_attributes PARAMS((int, int));
-extern int show_local_var_attributes PARAMS((int, int));
-extern int show_var_attributes PARAMS((SHELL_VAR *, int, int));
-extern int show_name_attributes PARAMS((char *, int));
-extern int show_localname_attributes PARAMS((char *, int));
-extern int show_func_attributes PARAMS((char *, int));
-extern void set_var_attribute PARAMS((char *, int, int));
-extern int var_attribute_string PARAMS((SHELL_VAR *, int, char *));
+extern int set_or_show_attributes (WORD_LIST *, int, int);
+extern int show_all_var_attributes (int, int);
+extern int show_local_var_attributes (int, int);
+extern int show_var_attributes (SHELL_VAR *, int, int);
+extern int show_name_attributes (char *, int);
+extern int show_localname_attributes (char *, int);
+extern int show_func_attributes (char *, int);
+extern void set_var_attribute (char *, int, int);
+extern int var_attribute_string (SHELL_VAR *, int, char *);
/* Functions from pushd.def */
-extern char *get_dirstack_from_string PARAMS((char *));
-extern char *get_dirstack_element PARAMS((intmax_t, int));
-extern void set_dirstack_element PARAMS((intmax_t, int, char *));
-extern WORD_LIST *get_directory_stack PARAMS((int));
+extern char *get_dirstack_from_string (char *);
+extern char *get_dirstack_element (intmax_t, int);
+extern void set_dirstack_element (intmax_t, int, char *);
+extern WORD_LIST *get_directory_stack (int);
/* Functions from evalstring.c */
-extern int parse_and_execute PARAMS((char *, const char *, int));
-extern int evalstring PARAMS((char *, const char *, int));
-extern void parse_and_execute_cleanup PARAMS((int));
-extern int parse_string PARAMS((char *, const char *, int, COMMAND **, char **));
-extern int should_suppress_fork PARAMS((COMMAND *));
-extern int can_optimize_connection PARAMS((COMMAND *));
-extern int can_optimize_cat_file PARAMS((COMMAND *));
-extern void optimize_connection_fork PARAMS((COMMAND *));
-extern void optimize_subshell_command PARAMS((COMMAND *));
-extern void optimize_shell_function PARAMS((COMMAND *));
+extern int parse_and_execute (char *, const char *, int);
+extern int evalstring (char *, const char *, int);
+extern void parse_and_execute_cleanup (int);
+extern int parse_string (char *, const char *, int, COMMAND **, char **);
+extern int should_suppress_fork (COMMAND *);
+extern int can_optimize_connection (COMMAND *);
+extern int can_optimize_cat_file (COMMAND *);
+extern void optimize_connection_fork (COMMAND *);
+extern void optimize_subshell_command (COMMAND *);
+extern void optimize_shell_function (COMMAND *);
/* Functions from evalfile.c */
-extern int maybe_execute_file PARAMS((const char *, int));
-extern int force_execute_file PARAMS((const char *, int));
-extern int source_file PARAMS((const char *, int));
-extern int fc_execute_file PARAMS((const char *));
+extern int maybe_execute_file (const char *, int);
+extern int force_execute_file (const char *, int);
+extern int source_file (const char *, int);
+extern int fc_execute_file (const char *);
/* variables from common.c */
extern sh_builtin_func_t *this_shell_builtin;
extern sh_builtin_func_t *last_shell_builtin;
-extern SHELL_VAR *builtin_bind_variable PARAMS((char *, char *, int));
-extern SHELL_VAR *builtin_bind_var_to_int PARAMS((char *, intmax_t, int));
-extern int builtin_unbind_variable PARAMS((const char *));
+extern SHELL_VAR *builtin_bind_variable (char *, char *, int);
+extern SHELL_VAR *builtin_bind_var_to_int (char *, intmax_t, int);
+extern int builtin_unbind_variable (const char *);
-extern SHELL_VAR *builtin_find_indexed_array PARAMS((char *, int));
-extern int builtin_arrayref_flags PARAMS((WORD_DESC *, int));
+extern SHELL_VAR *builtin_find_indexed_array (char *, int);
+extern int builtin_arrayref_flags (WORD_DESC *, int);
/* variables from evalfile.c */
extern int sourcelevel;
This file is complete.def, from which is created complete.c.
It implements the builtins "complete", "compgen", and "compopt" in Bash.
-Copyright (C) 1999-2021 Free Software Foundation, Inc.
+Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
int Iflag;
};
-static int find_compact PARAMS((char *));
-static int find_compopt PARAMS((char *));
+static int find_compact (char *);
+static int find_compopt (char *);
-static int build_actions PARAMS((WORD_LIST *, struct _optflags *, unsigned long *, unsigned long *));
+static int build_actions (WORD_LIST *, struct _optflags *, unsigned long *, unsigned long *);
-static int remove_cmd_completions PARAMS((WORD_LIST *));
+static int remove_cmd_completions (WORD_LIST *);
-static int print_one_completion PARAMS((char *, COMPSPEC *));
-static int print_compitem PARAMS((BUCKET_CONTENTS *));
-static void print_compopts PARAMS((const char *, COMPSPEC *, int));
-static void print_all_completions PARAMS((void));
-static int print_cmd_completions PARAMS((WORD_LIST *));
+static int print_one_completion (char *, COMPSPEC *);
+static int print_compitem (BUCKET_CONTENTS *);
+static void print_compopts (const char *, COMPSPEC *, int);
+static void print_all_completions (void);
+static int print_cmd_completions (WORD_LIST *);
-static void print_compoptions PARAMS((unsigned long, int));
-static void print_compactions PARAMS((unsigned long));
-static void print_arg PARAMS((const char *, const char *, int));
-static void print_cmd_name PARAMS((const char *));
+static void print_compoptions (unsigned long, int);
+static void print_compactions (unsigned long);
+static void print_arg (const char *, const char *, int);
+static void print_cmd_name (const char *);
static char *Garg, *Warg, *Parg, *Sarg, *Xarg, *Farg, *Carg;
This file is declare.def, from which is created declare.c.
It implements the builtins "declare" and "local" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include "builtext.h"
#include "bashgetopt.h"
-static SHELL_VAR *declare_find_variable PARAMS((const char *, int, int));
-static char *declare_build_newname PARAMS((char *, char *, int, char *, int));
-static char *declare_transform_name PARAMS((char *, int, int));
+static SHELL_VAR *declare_find_variable (const char *, int, int);
+static char *declare_build_newname (char *, char *, int, char *, int);
+static char *declare_transform_name (char *, int, int);
-static int declare_internal PARAMS((register WORD_LIST *, int));
+static int declare_internal (register WORD_LIST *, int);
/* Declare or change variable attributes. */
int
This file is enable.def, from which is created enable.c.
It implements the builtin "enable" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define SFLAG 0x20
#if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM)
-static int dyn_load_builtin PARAMS((WORD_LIST *, int, char *));
+static int dyn_load_builtin (WORD_LIST *, int, char *);
#endif
#if defined (HAVE_DLCLOSE)
-static int dyn_unload_builtin PARAMS((char *));
-static void delete_builtin PARAMS((struct builtin *));
-static int local_dlclose PARAMS((void *));
+static int dyn_unload_builtin (char *);
+static void delete_builtin (struct builtin *);
+static int local_dlclose (void *);
#endif
#define STRUCT_SUFFIX "_struct"
#define LOAD_SUFFIX "_builtin_load"
#define UNLOAD_SUFFIX "_builtin_unload"
-static void list_some_builtins PARAMS((int));
-static int enable_shell_command PARAMS((char *, int));
+static void list_some_builtins (int);
+static int enable_shell_command (char *, int);
/* Enable/disable shell commands present in LIST. If list is not specified,
then print out a list of shell commands showing which are enabled and
int sourcelevel = 0;
static int
-_evalfile (filename, flags)
- const char *filename;
- int flags;
+_evalfile (const char *filename, int flags)
{
volatile int old_interactive;
procenv_t old_return_catch;
}
int
-maybe_execute_file (fname, force_noninteractive)
- const char *fname;
- int force_noninteractive;
+maybe_execute_file (const char *fname, int force_noninteractive)
{
char *filename;
int result, flags;
}
int
-force_execute_file (fname, force_noninteractive)
- const char *fname;
- int force_noninteractive;
+force_execute_file (const char *fname, int force_noninteractive)
{
char *filename;
int result, flags;
#if defined (HISTORY)
int
-fc_execute_file (filename)
- const char *filename;
+fc_execute_file (const char *filename)
{
int flags;
#endif /* HISTORY */
int
-source_file (filename, sflags)
- const char *filename;
- int sflags;
+source_file (const char *filename, int sflags)
{
int flags, rval;
int parse_and_execute_level = 0;
-static int cat_file PARAMS((REDIRECT *));
+static int cat_file (REDIRECT *);
#define PE_TAG "parse_and_execute top"
#define PS_TAG "parse_string top"
This file is exit.def, from which is created exit.c.
It implements the builtins "exit", and "logout" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int check_jobs_at_exit;
-static int exit_or_logout PARAMS((WORD_LIST *));
+static int exit_or_logout (WORD_LIST *);
static int sourced_logout;
int
This file is fc.def, from which is created fc.c.
It implements the builtin "fc" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define HN_LISTING 0x01
#define HN_FIRST 0x02
-extern int unlink PARAMS((const char *));
+extern int unlink (const char *);
-extern FILE *sh_mktmpfp PARAMS((char *, int, char **));
+extern FILE *sh_mktmpfp (char *, int, char **);
extern int suppress_debug_trap_verbose;
} \
} while (0)
-static char *fc_dosubs PARAMS((char *, REPL *));
-static char *fc_gethist PARAMS((char *, HIST_ENTRY **, int));
-static int fc_gethnum PARAMS((char *, HIST_ENTRY **, int));
-static int fc_number PARAMS((WORD_LIST *));
-static void fc_replhist PARAMS((char *));
+static char *fc_dosubs (char *, REPL *);
+static char *fc_gethist (char *, HIST_ENTRY **, int);
+static int fc_gethnum (char *, HIST_ENTRY **, int);
+static int fc_number (WORD_LIST *);
+static void fc_replhist (char *);
#ifdef INCLUDE_UNUSED
-static char *fc_readline PARAMS((FILE *));
-static void fc_addhist PARAMS((char *));
+static char *fc_readline (FILE *);
+static void fc_addhist (char *);
#endif
static void
This file is fg_bg.def, from which is created fg_bg.c.
It implements the builtins "bg" and "fg" in Bash.
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include "bashgetopt.h"
#if defined (JOB_CONTROL)
-static int fg_bg PARAMS((WORD_LIST *, int));
+static int fg_bg (WORD_LIST *, int);
/* How to bring a job into the foreground. */
int
/* gen-helpfiles - create files containing builtin help text */
-/* Copyright (C) 2012-2021 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Forward declarations. */
-int write_helpfiles PARAMS((struct builtin *));
+int write_helpfiles (struct builtin *);
/* For each file mentioned on the command line, process it and
write the information to STRUCTFILE and EXTERNFILE, while
/* getopt.c - getopt for Bash. Used by the getopt builtin. */
-/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define NEEDARG(x) fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], x)
int
-sh_getopt (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
+sh_getopt (int argc, char *const *argv, const char *optstring)
{
char c, *temp;
}
void
-sh_getopt_restore_state (argv)
- char **argv;
+sh_getopt_restore_state (char **argv)
{
if (nextchar)
nextchar = argv[sh_curopt] + sh_charindex;
}
void
-sh_getopt_dispose_istate (gs)
- sh_getopt_state_t *gs;
+sh_getopt_dispose_istate (sh_getopt_state_t *gs)
{
free (gs);
}
sh_getopt_state_t *
-sh_getopt_save_istate ()
+sh_getopt_save_istate (void)
{
sh_getopt_state_t *ret;
}
void
-sh_getopt_restore_istate (state)
- sh_getopt_state_t *state;
+sh_getopt_restore_istate (sh_getopt_state_t *state)
{
sh_optarg = state->gs_optarg;
sh_optind = state->gs_optind;
#if 0
void
-sh_getopt_debug_restore_state (argv)
- char **argv;
+sh_getopt_debug_restore_state (char **argv)
{
if (nextchar && nextchar != argv[sh_curopt] + sh_charindex)
{
the above definition of `sh_getopt'. */
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int c;
int digit_sh_optind = 0;
/* getopt.h - declarations for getopt. */
-/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Set to 1 when an unrecognized option is encountered. */
extern int sh_badopt;
-extern int sh_getopt PARAMS((int, char *const *, const char *));
+extern int sh_getopt (int, char *const *, const char *);
typedef struct sh_getopt_state
{
int gs_flags;
} sh_getopt_state_t;
-extern void sh_getopt_restore_state PARAMS((char **));
+extern void sh_getopt_restore_state (char **);
-extern sh_getopt_state_t *sh_getopt_alloc_istate PARAMS((void));
-extern void sh_getopt_dispose_istate PARAMS((sh_getopt_state_t *));
+extern sh_getopt_state_t *sh_getopt_alloc_istate (void);
+extern void sh_getopt_dispose_istate (sh_getopt_state_t *);
-extern sh_getopt_state_t *sh_getopt_save_istate PARAMS((void));
-extern void sh_getopt_restore_istate PARAMS((sh_getopt_state_t *));
+extern sh_getopt_state_t *sh_getopt_save_istate (void);
+extern void sh_getopt_restore_istate (sh_getopt_state_t *);
#endif /* _SH_GETOPT_H */
This file is getopts.def, from which is created getopts.c.
It implements the builtin "getopts" in Bash.
-Copyright (C) 1987-2019 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define G_INVALID_OPT -2
#define G_ARG_MISSING -3
-static int getopts_unbind_variable PARAMS((char *));
-static int getopts_bind_variable PARAMS((char *, char *));
-static int dogetopts PARAMS((int, char **));
+static int getopts_unbind_variable (char *);
+static int getopts_bind_variable (char *, char *);
+static int dogetopts (int, char **);
/* getopts_reset is magic code for when OPTIND is reset. N is the
value that has just been assigned to OPTIND. */
This file is hash.def, from which is created hash.c.
It implements the builtin "hash" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int dot_found_in_search;
-static int add_hashed_command PARAMS((char *, int));
-static int print_hash_info PARAMS((BUCKET_CONTENTS *));
-static int print_portable_hash_info PARAMS((BUCKET_CONTENTS *));
-static int print_hashed_commands PARAMS((int));
-static int list_hashed_filename_targets PARAMS((WORD_LIST *, int));
+static int add_hashed_command (char *, int);
+static int print_hash_info (BUCKET_CONTENTS *);
+static int print_portable_hash_info (BUCKET_CONTENTS *);
+static int print_hashed_commands (int);
+static int list_hashed_filename_targets (WORD_LIST *, int);
/* Print statistics on the current state of hashed commands. If LIST is
not empty, then rehash (or hash in the first place) the specified
This file is help.def, from which is created help.c.
It implements the builtin "help" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern const char * const bash_copyright;
extern const char * const bash_license;
-static void show_builtin_command_help PARAMS((void));
-static int open_helpfile PARAMS((char *));
-static void show_desc PARAMS((char *, int));
-static void show_manpage PARAMS((char *, int));
-static void show_longdoc PARAMS((int));
+static void show_builtin_command_help (void);
+static int open_helpfile (char *);
+static void show_desc (char *, int);
+static void show_manpage (char *, int);
+static void show_longdoc (int);
/* Print out a list of the known functions in the shell, and what they do.
If LIST is supplied, print out the list which matches for each pattern
This file is history.def, from which is created history.c.
It implements the builtin "history" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int errno;
#endif
-static char *histtime PARAMS((HIST_ENTRY *, const char *));
-static int display_history PARAMS((WORD_LIST *));
-static void push_history PARAMS((WORD_LIST *));
-static int expand_and_print_history PARAMS((WORD_LIST *));
+static char *histtime (HIST_ENTRY *, const char *);
+static int display_history (WORD_LIST *);
+static void push_history (WORD_LIST *);
+static int expand_and_print_history (WORD_LIST *);
#define AFLAG 0x01
#define RFLAG 0x02
This file is jobs.def, from which is created jobs.c.
It implements the builtins "jobs" and "disown" in Bash.
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define JSTATE_RUNNING 0x1
#define JSTATE_STOPPED 0x2
-static int execute_list_with_replacements PARAMS((WORD_LIST *));
+static int execute_list_with_replacements (WORD_LIST *);
/* The `jobs' command. Prints outs a list of active jobs. If the
argument `-l' is given, then the process id's are printed also.
This file is kill.def, from which is created kill.c.
It implements the builtin "kill" in Bash.
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int errno;
#endif /* !errno */
-static void kill_error PARAMS((pid_t, int));
+static void kill_error (pid_t, int);
#if !defined (CONTINUE_AFTER_KILL_ERROR)
# define CONTINUE_OR_FAIL return (EXECUTION_FAILURE)
It implements the builtin "mapfile" in Bash.
Copyright (C) 2005-2006 Rocky Bernstein for Free Software Foundation, Inc.
-Copyright (C) 2008-2021 Free Software Foundation, Inc.
+Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#if defined (ARRAY_VARS)
-static int run_callback PARAMS((const char *, unsigned int, const char *));
+static int run_callback (const char *, unsigned int, const char *);
#define DEFAULT_ARRAY_NAME "MAPFILE"
#define DEFAULT_VARIABLE_NAME "MAPLINE" /* not used right now */
/* The definition of a function. */
typedef int Function ();
-typedef int mk_handler_func_t PARAMS((char *, DEF_FILE *, char *));
+typedef int mk_handler_func_t (char *, DEF_FILE *, char *);
/* Structure handles processor directives. */
typedef struct {
mk_handler_func_t *function;
} HANDLER_ENTRY;
-extern int builtin_handler PARAMS((char *, DEF_FILE *, char *));
-extern int function_handler PARAMS((char *, DEF_FILE *, char *));
-extern int short_doc_handler PARAMS((char *, DEF_FILE *, char *));
-extern int comment_handler PARAMS((char *, DEF_FILE *, char *));
-extern int depends_on_handler PARAMS((char *, DEF_FILE *, char *));
-extern int produces_handler PARAMS((char *, DEF_FILE *, char *));
-extern int end_handler PARAMS((char *, DEF_FILE *, char *));
-extern int docname_handler PARAMS((char *, DEF_FILE *, char *));
+extern int builtin_handler (char *, DEF_FILE *, char *);
+extern int function_handler (char *, DEF_FILE *, char *);
+extern int short_doc_handler (char *, DEF_FILE *, char *);
+extern int comment_handler (char *, DEF_FILE *, char *);
+extern int depends_on_handler (char *, DEF_FILE *, char *);
+extern int produces_handler (char *, DEF_FILE *, char *);
+extern int end_handler (char *, DEF_FILE *, char *);
+extern int docname_handler (char *, DEF_FILE *, char *);
HANDLER_ENTRY handlers[] = {
{ "BUILTIN", builtin_handler },
if (externfile)
{
if (builtin->function)
- fprintf (externfile, "extern int %s PARAMS((WORD_LIST *));\n",
+ fprintf (externfile, "extern int %s (WORD_LIST *);\n",
builtin->function);
fprintf (externfile, "extern char * const %s_doc[];\n",
extern time_t shell_start_time;
#if !HAVE_ASPRINTF
-extern int asprintf PARAMS((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
+extern int asprintf (char **, const char *, ...) __attribute__((__format__ (printf, 2, 3)));
#endif
#if !HAVE_VSNPRINTF
-extern int vsnprintf PARAMS((char *, size_t, const char *, va_list)) __attribute__((__format__ (printf, 3, 0)));
+extern int vsnprintf (char *, size_t, const char *, va_list) __attribute__((__format__ (printf, 3, 0)));
#endif
-static void printf_erange PARAMS((char *));
-static int printstr PARAMS((char *, char *, int, int, int));
-static int tescape PARAMS((char *, char *, int *, int *));
-static char *bexpand PARAMS((char *, int, int *, int *));
-static char *vbadd PARAMS((char *, int));
-static int vbprintf PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
-static char *mklong PARAMS((char *, char *, size_t));
-static int getchr PARAMS((void));
-static char *getstr PARAMS((void));
-static int getint PARAMS((void));
-static intmax_t getintmax PARAMS((void));
-static uintmax_t getuintmax PARAMS((void));
+static void printf_erange (char *);
+static int printstr (char *, char *, int, int, int);
+static int tescape (char *, char *, int *, int *);
+static char *bexpand (char *, int, int *, int *);
+static char *vbadd (char *, int);
+static int vbprintf (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
+static char *mklong (char *, char *, size_t);
+static int getchr (void);
+static char *getstr (void);
+static int getint (void);
+static intmax_t getintmax (void);
+static uintmax_t getuintmax (void);
#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD && !defined(STRTOLD_BROKEN)
typedef long double floatmax_t;
# define FLOATMAX_CONV ""
# define strtofltmax strtod
#endif
-static double getdouble PARAMS((void));
-static floatmax_t getfloatmax PARAMS((void));
+static double getdouble (void);
+static floatmax_t getfloatmax (void);
-static intmax_t asciicode PARAMS((void));
+static intmax_t asciicode (void);
static WORD_LIST *garglist, *orig_arglist;
static int retval;
/* psize-posix - display the pipe size on a Posix system. */
-/* Copyright 2008,2009 Free Software Foundation, Inc.
+/* Copyright 2008,2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include <unistd.h>
#include <stdlib.h>
-main(c, v)
-int c;
-char **v;
+main(int c, char **v)
{
char *p;
long l;
/* psize.c - Find pipe size. */
-/* Copyright (C) 1987, 1991 Free Software Foundation, Inc.
+/* Copyright (C) 1987, 1991, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
int nw;
sighandler
-sigpipe (sig)
- int sig;
+sigpipe (int sig)
{
fprintf (stderr, "%d\n", nw);
exit (0);
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char buf[128];
register int i;
This file is pushd.def, from which is created pushd.c. It implements the
builtins "pushd", "popd", and "dirs" in Bash.
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Offset to the end of the list. */
static int directory_list_offset;
-static void pushd_error PARAMS((int, char *));
-static void clear_directory_stack PARAMS((void));
-static int cd_to_string PARAMS((char *));
-static int change_to_temp PARAMS((char *));
-static void add_dirstack_element PARAMS((char *));
-static int get_dirstack_index PARAMS((intmax_t, int, int *));
+static void pushd_error (int, char *);
+static void clear_directory_stack (void);
+static int cd_to_string (char *);
+static int change_to_temp (char *);
+static void add_dirstack_element (char *);
+static int get_dirstack_index (intmax_t, int, int *);
#define NOCD 0x01
#define ROTATE 0x02
This file is read.def, from which is created read.c.
It implements the builtin "read" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
};
#if defined (READLINE)
-static void reset_attempted_completion_function PARAMS((char *));
-static int set_itext PARAMS((void));
-static char *edit_line PARAMS((char *, char *));
-static void set_eol_delim PARAMS((int));
-static void reset_eol_delim PARAMS((char *));
-static void set_readline_timeout PARAMS((sh_timer *t, time_t, long));
+static void reset_attempted_completion_function (char *);
+static int set_itext (void);
+static char *edit_line (char *, char *);
+static void set_eol_delim (int);
+static void reset_eol_delim (char *);
+static void set_readline_timeout (sh_timer *t, time_t, long);
#endif
-static SHELL_VAR *bind_read_variable PARAMS((char *, char *, int));
+static SHELL_VAR *bind_read_variable (char *, char *, int);
#if defined (HANDLE_MULTIBYTE)
-static int read_mbchar PARAMS((int, char *, int, int, int));
+static int read_mbchar (int, char *, int, int, int);
#endif
-static void ttyrestore PARAMS((struct ttsave *));
+static void ttyrestore (struct ttsave *);
-static sighandler sigalrm PARAMS((int));
-static void reset_timeout PARAMS((void));
+static sighandler sigalrm (int);
+static void reset_timeout (void);
/* Try this to see what the rest of the shell can do with the information. */
sh_timer *read_timeout;
Returns success unless an invalid option is given.
$END
-typedef int setopt_set_func_t PARAMS((int, char *));
-typedef int setopt_get_func_t PARAMS((char *));
+typedef int setopt_set_func_t (int, char *);
+typedef int setopt_get_func_t (char *);
-static int find_minus_o_option PARAMS((char *));
+static int find_minus_o_option (char *);
-static void print_minus_o_option PARAMS((char *, int, int));
-static void print_all_shell_variables PARAMS((void));
+static void print_minus_o_option (char *, int, int);
+static void print_all_shell_variables (void);
-static int set_ignoreeof PARAMS((int, char *));
-static int set_posix_mode PARAMS((int, char *));
+static int set_ignoreeof (int, char *);
+static int set_posix_mode (int, char *);
#if defined (READLINE)
-static int set_edit_mode PARAMS((int, char *));
-static int get_edit_mode PARAMS((char *));
+static int set_edit_mode (int, char *);
+static int get_edit_mode (char *);
#endif
#if defined (HISTORY)
-static int bash_set_history PARAMS((int, char *));
+static int bash_set_history (int, char *);
#endif
static const char * const on = "on";
extern int dircomplete_spelling, dircomplete_expand;
extern int complete_fullquote;
-extern int enable_hostname_completion PARAMS((int));
+extern int enable_hostname_completion (int);
#endif
#if defined (PROGRAMMABLE_COMPLETION)
extern int syslog_history;
#endif
-static void shopt_error PARAMS((char *));
+static void shopt_error (char *);
-static int set_shellopts_after_change PARAMS((char *, int));
-static int set_compatibility_level PARAMS((char *, int));
+static int set_shellopts_after_change (char *, int);
+static int set_compatibility_level (char *, int);
#if defined (RESTRICTED_SHELL)
-static int set_restricted_shell PARAMS((char *, int));
+static int set_restricted_shell (char *, int);
#endif
#if defined (READLINE)
-static int shopt_enable_hostname_completion PARAMS((char *, int));
-static int shopt_set_complete_direxpand PARAMS((char *, int));
+static int shopt_enable_hostname_completion (char *, int);
+static int shopt_set_complete_direxpand (char *, int);
#endif
#if defined (ARRAY_VARS)
-static int set_assoc_expand PARAMS((char *, int));
+static int set_assoc_expand (char *, int);
#endif
#if defined (EXTENDED_GLOB)
int extglob_flag = EXTGLOB_DEFAULT;
-static int shopt_set_extglob PARAMS((char *, int));
+static int shopt_set_extglob (char *, int);
#endif
int expaliases_flag = 0;
-static int shopt_set_expaliases PARAMS((char *, int));
+static int shopt_set_expaliases (char *, int);
-static int shopt_set_debug_mode PARAMS((char *, int));
+static int shopt_set_debug_mode (char *, int);
static int shopt_login_shell;
static int shopt_compat31;
static int shopt_compat43;
static int shopt_compat44;
-typedef int shopt_set_func_t PARAMS((char *, int));
+typedef int shopt_set_func_t (char *, int);
/* If you add a new variable name here, make sure to set the default value
appropriately in reset_shopt_options. */
static const char * const on = "on";
static const char * const off = "off";
-static int find_shopt PARAMS((char *));
-static int toggle_shopts PARAMS((int, WORD_LIST *, int));
-static void print_shopt PARAMS((char *, int, int));
-static int list_shopts PARAMS((WORD_LIST *, int));
-static int list_some_shopts PARAMS((int, int));
-static int list_shopt_o_options PARAMS((WORD_LIST *, int));
-static int list_some_o_options PARAMS((int, int));
-static int set_shopt_o_options PARAMS((int, WORD_LIST *, int));
+static int find_shopt (char *);
+static int toggle_shopts (int, WORD_LIST *, int);
+static void print_shopt (char *, int, int);
+static int list_shopts (WORD_LIST *, int);
+static int list_some_shopts (int, int);
+static int list_shopt_o_options (WORD_LIST *, int);
+static int list_some_o_options (int, int);
+static int set_shopt_o_options (int, WORD_LIST *, int);
#define SFLAG 0x01
#define UFLAG 0x02
This file is source.def, from which is created source.c.
It implements the builtins "." and "source" in Bash.
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int errno;
#endif /* !errno */
-static void maybe_pop_dollar_vars PARAMS((void));
+static void maybe_pop_dollar_vars (void);
/* If non-zero, `.' uses $PATH to look up the script to be sourced. */
int source_uses_path = 1;
#include "common.h"
#include "bashgetopt.h"
-static sighandler suspend_continue PARAMS((int));
+static sighandler suspend_continue (int);
static SigHandler *old_cont;
#if 0
This file is trap.def, from which is created trap.c.
It implements the builtin "trap" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include "common.h"
#include "bashgetopt.h"
-static void showtrap PARAMS((int, int));
-static int display_traps PARAMS((WORD_LIST *, int));
+static void showtrap (int, int);
+static int display_traps (WORD_LIST *, int);
/* The trap command:
#include "common.h"
#include "bashgetopt.h"
-extern int find_reserved_word PARAMS((char *));
+extern int find_reserved_word (char *);
/* For each word in LIST, find out what the shell is going to do with
it as a simple command. i.e., which file would this shell use to
This file is ulimit.def, from which is created ulimit.c.
It implements the builtin "ulimit" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define BLOCKSIZE(x) (((x) == POSIXBLK) ? (posixly_correct ? 512 : 1024) : (x))
-static int _findlim PARAMS((int));
+static int _findlim (int);
-static int ulimit_internal PARAMS((int, char *, int, int));
+static int ulimit_internal (int, char *, int, int);
-static int get_limit PARAMS((int, RLIMTYPE *, RLIMTYPE *));
-static int set_limit PARAMS((int, RLIMTYPE, int));
+static int get_limit (int, RLIMTYPE *, RLIMTYPE *);
+static int set_limit (int, RLIMTYPE, int);
-static void printone PARAMS((int, RLIMTYPE, int));
-static void print_all_limits PARAMS((int));
+static void printone (int, RLIMTYPE, int);
+static void print_all_limits (int);
-static int set_all_limits PARAMS((int, RLIMTYPE));
+static int set_all_limits (int, RLIMTYPE);
-static int filesize PARAMS((RLIMTYPE *));
-static int pipesize PARAMS((RLIMTYPE *));
-static int getmaxuprc PARAMS((RLIMTYPE *));
-static int getmaxvm PARAMS((RLIMTYPE *, RLIMTYPE *));
+static int filesize (RLIMTYPE *);
+static int pipesize (RLIMTYPE *);
+static int getmaxuprc (RLIMTYPE *);
+static int getmaxvm (RLIMTYPE *, RLIMTYPE *);
typedef struct {
int option; /* The ulimit option for this limit. */
/* */
/* **************************************************************** */
-static void print_symbolic_umask PARAMS((mode_t));
-static int symbolic_umask PARAMS((WORD_LIST *));
+static void print_symbolic_umask (mode_t);
+static int symbolic_umask (WORD_LIST *);
/* Set or display the mask used by the system when creating files. Flag
of -S means display the umask in a symbolic mode. */
This file is wait.def, from which is created wait.c.
It implements the builtin "wait" in Bash.
-Copyright (C) 1987-2021 Free Software Foundation, Inc.
+Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
procenv_t wait_intr_buf;
int wait_intr_flag;
-static int set_waitlist PARAMS((WORD_LIST *));
-static void unset_waitlist PARAMS((void));
+static int set_waitlist (WORD_LIST *);
+static void unset_waitlist (void);
/* Wait for the pid in LIST to stop or die. If no arguments are given, then
wait for all of the active background processes of the shell and return
/* command.h -- The structures used internally to represent commands, and
the extern declarations of the functions used to create them. */
-/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Forward declarations of functions declared in copy_cmd.c. */
-extern FUNCTION_DEF *copy_function_def_contents PARAMS((FUNCTION_DEF *, FUNCTION_DEF *));
-extern FUNCTION_DEF *copy_function_def PARAMS((FUNCTION_DEF *));
+extern FUNCTION_DEF *copy_function_def_contents (FUNCTION_DEF *, FUNCTION_DEF *);
+extern FUNCTION_DEF *copy_function_def (FUNCTION_DEF *);
-extern WORD_DESC *copy_word PARAMS((WORD_DESC *));
-extern WORD_LIST *copy_word_list PARAMS((WORD_LIST *));
-extern REDIRECT *copy_redirect PARAMS((REDIRECT *));
-extern REDIRECT *copy_redirects PARAMS((REDIRECT *));
-extern COMMAND *copy_command PARAMS((COMMAND *));
+extern WORD_DESC *copy_word (WORD_DESC *);
+extern WORD_LIST *copy_word_list (WORD_LIST *);
+extern REDIRECT *copy_redirect (REDIRECT *);
+extern REDIRECT *copy_redirects (REDIRECT *);
+extern COMMAND *copy_command (COMMAND *);
#endif /* _COMMAND_H_ */
primarily for making function definitions, but I'm not sure
that anyone else will need it. */
-/* 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.
#include "shell.h"
-static PATTERN_LIST *copy_case_clause PARAMS((PATTERN_LIST *));
-static PATTERN_LIST *copy_case_clauses PARAMS((PATTERN_LIST *));
-static FOR_COM *copy_for_command PARAMS((FOR_COM *));
+static PATTERN_LIST *copy_case_clause (PATTERN_LIST *);
+static PATTERN_LIST *copy_case_clauses (PATTERN_LIST *);
+static FOR_COM *copy_for_command (FOR_COM *);
#if defined (ARITH_FOR_COMMAND)
-static ARITH_FOR_COM *copy_arith_for_command PARAMS((ARITH_FOR_COM *));
+static ARITH_FOR_COM *copy_arith_for_command (ARITH_FOR_COM *);
#endif
-static GROUP_COM *copy_group_command PARAMS((GROUP_COM *));
-static SUBSHELL_COM *copy_subshell_command PARAMS((SUBSHELL_COM *));
-static COPROC_COM *copy_coproc_command PARAMS((COPROC_COM *));
-static CASE_COM *copy_case_command PARAMS((CASE_COM *));
-static WHILE_COM *copy_while_command PARAMS((WHILE_COM *));
-static IF_COM *copy_if_command PARAMS((IF_COM *));
+static GROUP_COM *copy_group_command (GROUP_COM *);
+static SUBSHELL_COM *copy_subshell_command (SUBSHELL_COM *);
+static COPROC_COM *copy_coproc_command (COPROC_COM *);
+static CASE_COM *copy_case_command (CASE_COM *);
+static WHILE_COM *copy_while_command (WHILE_COM *);
+static IF_COM *copy_if_command (IF_COM *);
#if defined (DPAREN_ARITHMETIC)
-static ARITH_COM *copy_arith_command PARAMS((ARITH_COM *));
+static ARITH_COM *copy_arith_command (ARITH_COM *);
#endif
#if defined (COND_COMMAND)
-static COND_COM *copy_cond_command PARAMS((COND_COM *));
+static COND_COM *copy_cond_command (COND_COM *);
#endif
-static SIMPLE_COM *copy_simple_command PARAMS((SIMPLE_COM *));
+static SIMPLE_COM *copy_simple_command (SIMPLE_COM *);
WORD_DESC *
-copy_word (w)
- WORD_DESC *w;
+copy_word (WORD_DESC *w)
{
WORD_DESC *new_word;
/* Copy the chain of words in LIST. Return a pointer to
the new chain. */
WORD_LIST *
-copy_word_list (list)
- WORD_LIST *list;
+copy_word_list (WORD_LIST *list)
{
WORD_LIST *new_list, *tl;
}
static PATTERN_LIST *
-copy_case_clause (clause)
- PATTERN_LIST *clause;
+copy_case_clause (PATTERN_LIST *clause)
{
PATTERN_LIST *new_clause;
}
static PATTERN_LIST *
-copy_case_clauses (clauses)
- PATTERN_LIST *clauses;
+copy_case_clauses (PATTERN_LIST *clauses)
{
PATTERN_LIST *new_list, *new_clause;
/* Copy a single redirect. */
REDIRECT *
-copy_redirect (redirect)
- REDIRECT *redirect;
+copy_redirect (REDIRECT *redirect)
{
REDIRECT *new_redirect;
new_redirect = (REDIRECT *)xmalloc (sizeof (REDIRECT));
-#if 0
- FASTCOPY ((char *)redirect, (char *)new_redirect, (sizeof (REDIRECT)));
-#else
*new_redirect = *redirect; /* let the compiler do the fast structure copy */
-#endif
if (redirect->rflags & REDIR_VARASSIGN)
new_redirect->redirector.filename = copy_word (redirect->redirector.filename);
}
REDIRECT *
-copy_redirects (list)
- REDIRECT *list;
+copy_redirects (REDIRECT *list)
{
REDIRECT *new_list, *temp;
}
static FOR_COM *
-copy_for_command (com)
- FOR_COM *com;
+copy_for_command (FOR_COM *com)
{
FOR_COM *new_for;
#if defined (ARITH_FOR_COMMAND)
static ARITH_FOR_COM *
-copy_arith_for_command (com)
- ARITH_FOR_COM *com;
+copy_arith_for_command (ARITH_FOR_COM *com)
{
ARITH_FOR_COM *new_arith_for;
#endif /* ARITH_FOR_COMMAND */
static GROUP_COM *
-copy_group_command (com)
- GROUP_COM *com;
+copy_group_command (GROUP_COM *com)
{
GROUP_COM *new_group;
}
static SUBSHELL_COM *
-copy_subshell_command (com)
- SUBSHELL_COM *com;
+copy_subshell_command (SUBSHELL_COM *com)
{
SUBSHELL_COM *new_subshell;
}
static COPROC_COM *
-copy_coproc_command (com)
- COPROC_COM *com;
+copy_coproc_command (COPROC_COM *com)
{
COPROC_COM *new_coproc;
}
static CASE_COM *
-copy_case_command (com)
- CASE_COM *com;
+copy_case_command (CASE_COM *com)
{
CASE_COM *new_case;
}
static WHILE_COM *
-copy_while_command (com)
- WHILE_COM *com;
+copy_while_command (WHILE_COM *com)
{
WHILE_COM *new_while;
}
static IF_COM *
-copy_if_command (com)
- IF_COM *com;
+copy_if_command (IF_COM *com)
{
IF_COM *new_if;
#if defined (DPAREN_ARITHMETIC)
static ARITH_COM *
-copy_arith_command (com)
- ARITH_COM *com;
+copy_arith_command (ARITH_COM *com)
{
ARITH_COM *new_arith;
#if defined (COND_COMMAND)
static COND_COM *
-copy_cond_command (com)
- COND_COM *com;
+copy_cond_command (COND_COM *com)
{
COND_COM *new_cond;
#endif
static SIMPLE_COM *
-copy_simple_command (com)
- SIMPLE_COM *com;
+copy_simple_command (SIMPLE_COM *com)
{
SIMPLE_COM *new_simple;
}
FUNCTION_DEF *
-copy_function_def_contents (old, new_def)
- FUNCTION_DEF *old, *new_def;
+copy_function_def_contents (FUNCTION_DEF *old, FUNCTION_DEF *new_def)
{
new_def->name = copy_word (old->name);
new_def->command = old->command ? copy_command (old->command) : old->command;
}
FUNCTION_DEF *
-copy_function_def (com)
- FUNCTION_DEF *com;
+copy_function_def (FUNCTION_DEF *com)
{
FUNCTION_DEF *new_def;
copy. Don't you forget to dispose_command () on this pointer
later! */
COMMAND *
-copy_command (command)
- COMMAND *command;
+copy_command (COMMAND *command)
{
COMMAND *new_command;
/* dispose_command.c -- dispose of a COMMAND structure. */
-/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Dispose of the command structure passed. */
void
-dispose_command (command)
- COMMAND *command;
+dispose_command (COMMAND *command)
{
if (command == 0)
return;
#if defined (COND_COMMAND)
/* How to free a node in a conditional command. */
void
-dispose_cond_node (cond)
- COND_COM *cond;
+dispose_cond_node (COND_COM *cond)
{
if (cond)
{
#endif /* COND_COMMAND */
void
-dispose_function_def_contents (c)
- FUNCTION_DEF *c;
+dispose_function_def_contents (FUNCTION_DEF *c)
{
dispose_word (c->name);
dispose_command (c->command);
}
void
-dispose_function_def (c)
- FUNCTION_DEF *c;
+dispose_function_def (FUNCTION_DEF *c)
{
dispose_function_def_contents (c);
free (c);
/* How to free a WORD_DESC. */
void
-dispose_word (w)
- WORD_DESC *w;
+dispose_word (WORD_DESC *w)
{
FREE (w->word);
ocache_free (wdcache, WORD_DESC, w);
/* Free a WORD_DESC, but not the word contained within. */
void
-dispose_word_desc (w)
- WORD_DESC *w;
+dispose_word_desc (WORD_DESC *w)
{
w->word = 0;
ocache_free (wdcache, WORD_DESC, w);
/* How to get rid of a linked list of words. A WORD_LIST. */
void
-dispose_words (list)
- WORD_LIST *list;
+dispose_words (WORD_LIST *list)
{
WORD_LIST *t;
/* How to dispose of an array of pointers to char. This is identical to
free_array in stringlib.c. */
void
-dispose_word_array (array)
- char **array;
+dispose_word_array (char **array)
{
register int count;
/* How to dispose of an list of redirections. A REDIRECT. */
void
-dispose_redirects (list)
- REDIRECT *list;
+dispose_redirects (REDIRECT *list)
{
register REDIRECT *t;
/* dispose_cmd.h -- Functions appearing in dispose_cmd.c. */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include "stdc.h"
-extern void dispose_command PARAMS((COMMAND *));
-extern void dispose_word_desc PARAMS((WORD_DESC *));
-extern void dispose_word PARAMS((WORD_DESC *));
-extern void dispose_words PARAMS((WORD_LIST *));
-extern void dispose_word_array PARAMS((char **));
-extern void dispose_redirects PARAMS((REDIRECT *));
+extern void dispose_command (COMMAND *);
+extern void dispose_word_desc (WORD_DESC *);
+extern void dispose_word (WORD_DESC *);
+extern void dispose_words (WORD_LIST *);
+extern void dispose_word_array (char **);
+extern void dispose_redirects (REDIRECT *);
#if defined (COND_COMMAND)
-extern void dispose_cond_node PARAMS((COND_COM *));
+extern void dispose_cond_node (COND_COM *);
#endif
-extern void dispose_function_def_contents PARAMS((FUNCTION_DEF *));
-extern void dispose_function_def PARAMS((FUNCTION_DEF *));
+extern void dispose_function_def_contents (FUNCTION_DEF *);
+extern void dispose_function_def (FUNCTION_DEF *);
#endif /* !_DISPOSE_CMD_H_ */
/* error.h -- External declarations of functions appearing in error.c. */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include "stdc.h"
/* Get the name of the shell or shell script for an error message. */
-extern char *get_name_for_error PARAMS((void));
+extern char *get_name_for_error (void);
/* Report an error having to do with FILENAME. */
-extern void file_error PARAMS((const char *));
+extern void file_error (const char *);
/* Report a programmer's error, and abort. Pass REASON, and ARG1 ... ARG5. */
-extern void programming_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+extern void programming_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
/* General error reporting. Pass FORMAT and ARG1 ... ARG5. */
-extern void report_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+extern void report_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
/* Error messages for parts of the parser that don't call report_syntax_error */
-extern void parser_error PARAMS((int, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
+extern void parser_error (int, const char *, ...) __attribute__((__format__ (printf, 2, 3)));
/* Report an unrecoverable error and exit. Pass FORMAT and ARG1 ... ARG5. */
-extern void fatal_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+extern void fatal_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
/* Report a system error, like BSD warn(3). */
-extern void sys_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+extern void sys_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
/* Report an internal error. */
-extern void internal_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+extern void internal_error (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
/* Report an internal warning. */
-extern void internal_warning PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+extern void internal_warning (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
/* Report an internal warning for debugging purposes. */
-extern void internal_debug PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+extern void internal_debug (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
/* Report an internal informational notice. */
-extern void internal_inform PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+extern void internal_inform (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
/* Debugging functions, not enabled in released version. */
-extern char *strescape PARAMS((const char *));
-extern void itrace PARAMS((const char *, ...)) __attribute__ ((__format__ (printf, 1, 2)));
-extern void trace PARAMS((const char *, ...)) __attribute__ ((__format__ (printf, 1, 2)));
+extern char *strescape (const char *);
+extern void itrace (const char *, ...) __attribute__ ((__format__ (printf, 1, 2)));
+extern void trace (const char *, ...) __attribute__ ((__format__ (printf, 1, 2)));
/* Report an error having to do with command parsing or execution. */
-extern void command_error PARAMS((const char *, int, int, int));
+extern void command_error (const char *, int, int, int);
-extern char *command_errstr PARAMS((int));
+extern char *command_errstr (int);
/* Specific error message functions that eventually call report_error or
internal_error. */
-extern void err_badarraysub PARAMS((const char *));
-extern void err_unboundvar PARAMS((const char *));
-extern void err_readonly PARAMS((const char *));
+extern void err_badarraysub (const char *);
+extern void err_unboundvar (const char *);
+extern void err_readonly (const char *);
#ifdef DEBUG
# define INTERNAL_DEBUG(x) internal_debug x
/* accept - listen for and accept a remote network connection on a given port */
/*
- Copyright (C) 2020 Free Software Foundation, Inc.
+ Copyright (C) 2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
static int accept_bind_variable (char *, int);
int
-accept_builtin (list)
- WORD_LIST *list;
+accept_builtin (WORD_LIST *list)
{
SHELL_VAR *v;
intmax_t iport;
}
static int
-accept_bind_variable (varname, intval)
- char *varname;
- int intval;
+accept_bind_variable (char *varname, int intval)
{
SHELL_VAR *v;
char ibuf[INT_STRLEN_BOUND (int) + 1], *p;
/*
- Copyright (C) 2020 Free Software Foundation, Inc.
+ Copyright (C) 2020,2022 Free Software Foundation, Inc.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
static int numeric_flag;
static int
-compare(const void *p1, const void *p2) {
+compare(const void *p1, const void *p2)
+{
const sort_element e1 = *(sort_element *) p1;
const sort_element e2 = *(sort_element *) p2;
}
static int
-sort_index(SHELL_VAR *dest, SHELL_VAR *source) {
+sort_index(SHELL_VAR *dest, SHELL_VAR *source)
+{
HASH_TABLE *hash;
BUCKET_CONTENTS *bucket;
sort_element *sa;
}
static int
-sort_inplace(SHELL_VAR *var) {
+sort_inplace(SHELL_VAR *var)
+{
size_t i, n;
ARRAY *a;
ARRAY_ELEMENT *ae;
}
int
-asort_builtin(WORD_LIST *list) {
+asort_builtin(WORD_LIST *list)
+{
SHELL_VAR *var, *var2;
char *word;
int opt, ret;
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#include "bashgetopt.h"
int
-basename_builtin (list)
- WORD_LIST *list;
+basename_builtin (WORD_LIST *list)
{
int slen, sufflen, off;
char *string, *suffix, *fn;
extern int errno;
#endif
-extern char *strerror ();
-extern char **make_builtin_argv ();
+extern char *strerror (int);
+extern char **make_builtin_argv (WORD_LIST *, int *);
static int
-fcopy(fd, fn)
-int fd;
-char *fn;
+fcopy(int fd, char *fn)
{
char buf[4096], *s;
int n, w, e;
}
int
-cat_main (argc, argv)
-int argc;
-char **argv;
+cat_main (int argc, char **argv)
{
int i, fd, r;
char *s;
}
int
-cat_builtin(list)
-WORD_LIST *list;
+cat_builtin(WORD_LIST *list)
{
char **v;
int c, r;
extern int errno;
#endif
-extern char *strerror ();
-extern char **make_builtin_argv ();
+extern char *strerror (int);
+extern char **make_builtin_argv (WORD_LIST *, int *);
static int
-fcopy(fd, fn)
-int fd;
-char *fn;
+fcopy(int fd, char *fn)
{
char buf[4096], *s;
int n, w, e;
}
int
-cat_main (argc, argv)
-int argc;
-char **argv;
+cat_main (int argc, char **argv)
{
int i, fd, r;
char *s;
}
int
-cat_builtin(list)
-WORD_LIST *list;
+cat_builtin(WORD_LIST *list)
{
char **v;
int c, r;
fields */
/*
- Copyright (C) 2020 Free Software Foundation, Inc.
+ Copyright (C) 2020,2022 Free Software Foundation, Inc.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
element of array variable CSV, starting at index 0. The format of LINE is
as described in RFC 4180. */
static int
-csvsplit (csv, line, dstring)
- SHELL_VAR *csv;
- char *line, *dstring;
+csvsplit (SHELL_VAR *csv, char *line, char *dstring)
{
arrayind_t ind;
char *field, *prev, *buf, *xbuf;
}
int
-csv_builtin (list)
- WORD_LIST *list;
+csv_builtin (WORD_LIST *list)
{
int opt, rval;
char *array_name, *csvstring;
/* Called when builtin is enabled and loaded from the shared object. If this
function returns 0, the load fails. */
int
-csv_builtin_load (name)
- char *name;
+csv_builtin_load (char *name)
{
return (1);
}
/* Called when builtin is disabled. */
void
-csv_builtin_unload (name)
- char *name;
+csv_builtin_unload (char *name)
{
}
or print them to the standard output */
/*
- Copyright (C) 2020 Free Software Foundation, Inc.
+ Copyright (C) 2020,2022 Free Software Foundation, Inc.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
};
static int
-poscmp (a, b)
- void *a, *b;
+poscmp (const void *a, const void *b)
{
struct cutpos *p1, *p2;
}
static int
-getlist (arg, opp)
- char *arg;
- struct cutpos **opp;
+getlist (char *arg, struct cutpos **opp)
{
char *ntok, *ltok, *larg;
int s, e;
}
static int
-cutbytes (v, line, ops)
- SHELL_VAR *v;
- char *line;
- struct cutop *ops;
+cutbytes (SHELL_VAR *v, char *line, struct cutop *ops)
{
arrayind_t ind;
char *buf, *bmap;
}
static int
-cutchars (v, line, ops)
- SHELL_VAR *v;
- char *line;
- struct cutop *ops;
+cutchars (SHELL_VAR *v, char *line, struct cutop *ops)
{
arrayind_t ind;
char *buf, *bmap;
bitmap approach as cut{bytes,chars} and assign them to the array variable
V or print them on stdout. This function obeys SFLAG. */
static int
-cutfields (v, line, ops)
- SHELL_VAR *v;
- char *line;
- struct cutop *ops;
+cutfields (SHELL_VAR *v, char *line, struct cutop *ops)
{
arrayind_t ind;
char *buf, *bmap, *field, **fields, delim[2];
}
static int
-cutline (v, line, ops)
- SHELL_VAR *v;
- char *line;
- struct cutop *ops;
+cutline (SHELL_VAR *v, char *line, struct cutop *ops)
{
int rval;
}
static int
-cutfile (v, list, ops)
- SHELL_VAR *v;
- WORD_LIST *list;
- struct cutop *ops;
+cutfile (SHELL_VAR *v, WORD_LIST *list, struct cutop *ops)
{
int fd, unbuffered_read;
char *line, *b;
#define OPTSET(x) ((cutflags & (x)) ? 1 : 0)
static int
-cut_internal (which, list)
- int which; /* not used yet */
- WORD_LIST *list;
+cut_internal (int which, WORD_LIST *list)
{
int opt, rval, cutflags, delim, npos;
char *array_name, *cutstring, *list_arg;
}
int
-lcut_builtin (list)
- WORD_LIST *list;
+lcut_builtin (WORD_LIST *list)
{
return (cut_internal (0, list));
}
int
-cut_builtin (list)
- WORD_LIST *list;
+cut_builtin (WORD_LIST *list)
{
return (cut_internal (1, list));
}
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#include "bashgetopt.h"
int
-dirname_builtin (list)
- WORD_LIST *list;
+dirname_builtin (WORD_LIST *list)
{
int slen;
char *string;
null fields. If you want to preserve the quote characters in the generated
fields, pass F_PRESERVE; by default, this removes them. */
static int
-dsvsplit (dsv, line, dstring, flags)
- SHELL_VAR *dsv;
- char *line, *dstring;
- int flags;
+dsvsplit (SHELL_VAR *dsv, char *line, char *dstring, int flags)
{
arrayind_t ind;
char *field, *prev, *buf, *xbuf;
}
int
-dsv_builtin (list)
- WORD_LIST *list;
+dsv_builtin (WORD_LIST *list)
{
int opt, rval, flags;
char *array_name, *dsvstring, *delims;
/* Called when builtin is enabled and loaded from the shared object. If this
function returns 0, the load fails. */
int
-dsv_builtin_load (name)
- char *name;
+dsv_builtin_load (char *name)
{
return (1);
}
/* Called when builtin is disabled. */
void
-dsv_builtin_unload (name)
- char *name;
+dsv_builtin_unload (char *name)
{
}
/* FIX THIS */
static int
-getallflags ()
+getallflags (void)
{
int i, allflags;
}
static int
-getmaxfd ()
+getmaxfd (void)
{
int maxfd, ignore;
*/
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
extern int errno;
#endif
-extern char **make_builtin_argv ();
+extern char **make_builtin_argv (WORD_LIST *, int *);
-static void perms();
-static int printst();
-static int printsome();
-static void printmode();
-static int printfinfo();
-static int finfo_main();
+static int octal(char *);
+static struct stat *getstat(char *);
+static int printinfo(char *);
+static int getperm(int);
+
+static void perms(int);
+static int printst(struct stat *);
+static int printsome(char *, int);
+static void printmode(int);
+static int printfinfo(char *);
+static int finfo_main(int, char **);
extern int sh_optind;
extern char *sh_optarg;
#endif
static void
-munge_list (list)
- WORD_LIST *list;
+munge_list (WORD_LIST *list)
{
WORD_LIST *l, *nl;
WORD_DESC *wd;
}
static int
-file_head (fp, cnt)
- FILE *fp;
- int cnt;
+file_head (FILE *fp, int cnt)
{
int ch;
}
int
-head_builtin (list)
- WORD_LIST *list;
+head_builtin (WORD_LIST *list)
{
int nline, opt, rval;
WORD_LIST *l;
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
A builtin command returns EXECUTION_SUCCESS for success and
EXECUTION_FAILURE to indicate failure. */
int
-hello_builtin (list)
- WORD_LIST *list;
+hello_builtin (WORD_LIST *list)
{
printf("hello world\n");
fflush (stdout);
}
int
-hello_builtin_load (s)
- char *s;
+hello_builtin_load (char *s)
{
printf ("hello builtin loaded\n");
fflush (stdout);
}
void
-hello_builtin_unload (s)
- char *s;
+hello_builtin_unload (char *s)
{
printf ("hello builtin unloaded\n");
fflush (stdout);
*/
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
static char *id_user;
-static int inituser ();
+static int inituser (char *);
-static int id_pruser ();
-static int id_prgrp ();
-static int id_prgroups ();
-static int id_prall ();
+static int id_pruser (int);
+static int id_prgrp (int);
+static int id_prgroups (char *);
+static int id_prall (char *);
int
-id_builtin (list)
- WORD_LIST *list;
+id_builtin (WORD_LIST *list)
{
int opt;
char *user;
}
static int
-inituser (uname)
- char *uname;
+inituser (char *uname)
{
struct passwd *pwd;
/* Print the name or value of user ID UID. */
static int
-id_pruser (uid)
- int uid;
+id_pruser (int uid)
{
struct passwd *pwd = NULL;
int r;
/* Print the name or value of group ID GID. */
static int
-id_prgrp (gid)
- int gid;
+id_prgrp (int gid)
{
struct group *grp = NULL;
int r;
}
static int
-id_prgroups (uname)
- char *uname;
+id_prgroups (char *uname)
{
int *glist, ng, i, r;
}
static int
-id_prall (uname)
- char *uname;
+id_prall (char *uname)
{
int r, i, ng, *glist;
struct passwd *pwd;
print them to the standard output */
/*
- Copyright (C) 2020 Free Software Foundation, Inc.
+ Copyright (C) 2020,2022 Free Software Foundation, Inc.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
};
static int
-poscmp (a, b)
- void *a, *b;
+poscmp (const void *a, const void *b)
{
struct cutpos *p1, *p2;
}
static int
-getlist (arg, opp)
- char *arg;
- struct cutpos **opp;
+getlist (char *arg, struct cutpos **opp)
{
char *ntok, *ltok, *larg;
int s, e;
}
static int
-cutbytes (v, line, ops)
- SHELL_VAR *v;
- char *line;
- struct cutop *ops;
+cutbytes (SHELL_VAR *v, char *line, struct cutop *ops)
{
arrayind_t ind;
char *buf, *bmap;
}
static int
-cutchars (v, line, ops)
- SHELL_VAR *v;
- char *line;
- struct cutop *ops;
+cutchars (SHELL_VAR *v, char *line, struct cutop *ops)
{
arrayind_t ind;
char *buf, *bmap;
bitmap approach as cut{bytes,chars} and assign them to the array variable
V or print them on stdout. This function obeys SFLAG. */
static int
-cutfields (v, line, ops)
- SHELL_VAR *v;
- char *line;
- struct cutop *ops;
+cutfields (SHELL_VAR *v, char *line, struct cutop *ops)
{
arrayind_t ind;
char *buf, *bmap, *field, **fields, delim[2];
}
static int
-cutline (v, line, ops)
- SHELL_VAR *v;
- char *line;
- struct cutop *ops;
+cutline (SHELL_VAR *v, char *line, struct cutop *ops)
{
int rval;
}
static int
-cutfile (v, list, ops)
- SHELL_VAR *v;
- WORD_LIST *list;
- struct cutop *ops;
+cutfile (SHELL_VAR *v, WORD_LIST *list, struct cutop *ops)
{
}
#define OPTSET(x) ((cutflags & (x)) ? 1 : 0)
static int
-cut_internal (which, list)
- int which; /* not used yet */
- WORD_LIST *list;
+cut_internal (int which, WORD_LIST *list)
{
int opt, rval, cutflags, delim, npos;
char *array_name, *cutstring, *list_arg;
}
int
-lcut_builtin (list)
- WORD_LIST *list;
+lcut_builtin (WORD_LIST *list)
{
return (cut_internal (0, list));
}
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
extern int errno;
#endif
-typedef int unix_link_syscall_t PARAMS((const char *, const char *));
+typedef int unix_link_syscall_t (const char *, const char *);
#define LN_SYMLINK 0x01
#define LN_UNLINK 0x02
#define LN_NOFOLLOW 0x04
static unix_link_syscall_t *linkfn;
-static int dolink ();
+
+static char *mkdirpath (char *, char *);
+static int dolink (char *, char *, int);
int
-ln_builtin (list)
- WORD_LIST *list;
+ln_builtin (WORD_LIST *list)
{
int rval, opt, flags;
WORD_LIST *l;
}
static char *
-mkdirpath (dir, file)
- char *dir, *file;
+mkdirpath (char *dir, char *file)
{
int dlen, flen;
char *ret;
#endif
static int
-dolink (src, dst, flags)
- char *src, *dst;
- int flags;
+dolink (char *src, char *dst, int flags)
{
struct stat ssb, dsb;
int exists;
/* logname - print login name of current user */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#endif
int
-logname_builtin (list)
- WORD_LIST *list;
+logname_builtin (WORD_LIST *list)
{
char *np;
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#define ISOCTAL(c) ((c) >= '0' && (c) <= '7')
-extern int parse_symbolic_mode ();
+extern int parse_symbolic_mode (char *, mode_t);
-static int make_path ();
+static int make_path (char *, int, int, int);
static int original_umask;
int
-mkdir_builtin (list)
- WORD_LIST *list;
+mkdir_builtin (WORD_LIST *list)
{
int opt, pflag, mflag, omode, rval, nmode, parent_mode;
char *mode;
this changes the process's umask; make sure that all paths leading to a
return reset it to ORIGINAL_UMASK */
static int
-make_path (path, user_mode, nmode, parent_mode)
- char *path;
- int user_mode;
- int nmode, parent_mode;
+make_path (char *path, int user_mode, int nmode, int parent_mode)
{
int oumask;
struct stat sb;
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#define ISOCTAL(c) ((c) >= '0' && (c) <= '7')
-extern int parse_symbolic_mode ();
+extern int parse_symbolic_mode (char *, mode_t);
static int original_umask;
int
-mkfifo_builtin (list)
- WORD_LIST *list;
+mkfifo_builtin (WORD_LIST *list)
{
int opt, mflag, omode, rval, nmode, basemode;
char *mode;
/* mktemp - create temporary file or directory */
/*
- Copyright (C) 2019 Free Software Foundation, Inc.
+ Copyright (C) 2019,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#define DEFAULT_PREFIX "shtmp"
int
-mktemp_builtin (list)
- WORD_LIST *list;
+mktemp_builtin (WORD_LIST *list)
{
WORD_LIST *l;
int rval, opt, fd, mflags, base_mflags;
while (0)
static SHELL_VAR *
-assign_mypid (
- SHELL_VAR *self,
- char *value,
- arrayind_t unused,
- char *key )
+assign_mypid (SHELL_VAR *self, char *value, arrayind_t unused, char *key)
{
return (self);
}
existing builtin. */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#include "shell.h"
int
-necho_builtin (list)
-WORD_LIST *list;
+necho_builtin (WORD_LIST *list)
{
print_word_list (list, " ");
printf("\n");
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
# define NAME_MAX_FOR(p) NAME_MAX
#endif
-extern char *strerror ();
+extern char *strerror (int);
-static int validate_path ();
+static int validate_path (char *, int);
int
pathchk_builtin (list)
/* If PATH contains only portable characters, return 1, else 0. */
static int
-portable_chars_only (path)
- const char *path;
+portable_chars_only (const char *path)
{
const char *p;
#else
# define SAFE_STAT(name, buf) safe_stat (name, buf)
static inline int
-safe_stat (name, buf)
- const char *name;
- struct stat *buf;
+safe_stat (const char *name, struct stat *buf)
{
int ret;
2 if it doesn't exist. */
static int
-dir_ok (path)
- const char *path;
+dir_ok (const char *path)
{
struct stat stats;
}
static char *
-xstrdup (s)
- char *s;
+xstrdup (char *s)
{
return (savestring (s));
}
Return 0 if all of these tests are successful, 1 if any fail. */
static int
-validate_path (path, portability)
- char *path;
- int portability;
+validate_path (char *path, int portability)
{
int path_max;
int last_elem; /* Nonzero if checking last element of path. */
*/
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
extern int errno;
#endif
-int print_builtin ();
-static int printargs ();
+int print_builtin (WORD_LIST *);
+static int printargs (WORD_LIST *, FILE *);
static FILE *ofp;
#endif
int
-print_builtin (list)
- WORD_LIST *list;
+print_builtin (WORD_LIST *list)
{
int c, r, nflag, raw, ofd, sflag;
intmax_t lfd;
}
static int
-printargs (list, ofp)
- WORD_LIST *list;
- FILE *ofp;
+printargs (WORD_LIST *list, FILE *ofp)
{
WORD_LIST *l;
char *ostr;
*/
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009, 2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
extern char **export_env;
int
-printenv_builtin (list)
- WORD_LIST *list;
+printenv_builtin (WORD_LIST *list)
{
register char **envp;
int opt;
*/
/*
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2020,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
extern int last_command_exit_value;
int
-push_builtin (list)
- WORD_LIST *list;
+push_builtin (WORD_LIST *list)
{
pid_t pid;
int xstatus, opt;
extern int errno;
#endif
-extern char *sh_realpath();
+extern char *sh_realpath(const char *, char *);
int
realpath_builtin(WORD_LIST *list)
/* See Makefile for compilation details. */
/*
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
}
int
-rm_builtin (list)
- WORD_LIST *list;
+rm_builtin (WORD_LIST *list)
{
const char *name;
WORD_LIST *l;
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#endif
int
-rmdir_builtin (list)
- WORD_LIST *list;
+rmdir_builtin (WORD_LIST *list)
{
int rval;
WORD_LIST *l;
/* seq - print sequence of numbers to standard output.
- Copyright (C) 2018-2020 Free Software Foundation, Inc.
+ Copyright (C) 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
# define FLOATMAX_FMT "%g"
# define FLOATMAX_WFMT "%0.f"
#endif
-static floatmax_t getfloatmax PARAMS((const char *));
-static char *genformat PARAMS((floatmax_t, floatmax_t, floatmax_t));
+static floatmax_t getfloatmax (const char *);
+static char *genformat (floatmax_t, floatmax_t, floatmax_t);
#define MAX(a, b) (((a) < (b))? (b) : (a))
/* Pretty much the same as the version in builtins/printf.def */
static floatmax_t
-getfloatmax (arg)
- const char *arg;
+getfloatmax (const char *arg)
{
floatmax_t ret;
char *ep;
/* Return the number of digits following the decimal point in NUMBUF */
static int
-getprec (numbuf)
- const char *numbuf;
+getprec (const char *numbuf)
{
int p;
char *dp;
/* Return the default format given FIRST, INCR, and LAST. */
static char *
-genformat (first, incr, last)
- floatmax_t first, incr, last;
+genformat (floatmax_t first, floatmax_t incr, floatmax_t last)
{
static char buf[6 + 2 * INT_STRLEN_BOUND (int)];
int wfirst, wlast, width;
}
int
-print_fltseq (fmt, first, last, incr)
- const char *fmt;
- floatmax_t first, last, incr;
+print_fltseq (const char *fmt, floatmax_t first, floatmax_t last, floatmax_t incr)
{
int n;
floatmax_t next;
/* must be <= INT_STRLEN_BOUND(intmax_t) */
int
-width_needed (num)
- intmax_t num;
+width_needed (intmax_t num)
{
int ret;
}
int
-print_intseq (ifirst, ilast, iincr)
- intmax_t ifirst, ilast, iincr;
+print_intseq (intmax_t ifirst, intmax_t ilast, intmax_t iincr)
{
char intwfmt[6 + INT_STRLEN_BOUND(int) + sizeof (PRIdMAX)];
const char *s;
}
int
-seq_builtin (list)
- WORD_LIST *list;
+seq_builtin (WORD_LIST *list)
{
floatmax_t first, last, incr;
intmax_t ifirst, ilast, iincr;
Originally contributed by Jason Vas Dias <jason.vas.dias@gmail.com>
+ Copyright (C) 2018-2022 Free Software Foundation, Inc.
+
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
#endif
int
-setpgid_builtin (list)
- WORD_LIST *list;
+setpgid_builtin (WORD_LIST *list)
{
register WORD_LIST *wl;
intmax_t pid_arg, pgid_arg;
*/
/*
- Copyright (C) 1999-2021 Free Software Foundation, Inc.
+ Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
static char *stattime (time_t, const char *);
static int
-getstat (fname, flags, sp)
- const char *fname;
- int flags;
- struct stat *sp;
+getstat (const char *fname, int flags, struct stat *sp)
{
intmax_t lfd;
int fd, r;
}
static char *
-statlink (fname, sp)
- char *fname;
- struct stat *sp;
+statlink (char *fname, struct stat *sp)
{
#if defined (HAVE_READLINK)
char linkbuf[PATH_MAX];
}
static char *
-octalperms (m)
- int m;
+octalperms (int m)
{
int operms;
char *ret;
}
static char *
-statperms (m)
- int m;
+statperms (int m)
{
char ubits[4], gbits[4], obits[4]; /* u=rwx,g=rwx,o=rwx */
int i;
}
static char *
-statmode(mode)
- int mode;
+statmode(int mode)
{
char *modestr, *m;
}
static char *
-stattime (t, timefmt)
- time_t t;
- const char *timefmt;
+stattime (time_t t, const char *timefmt)
{
char *tbuf, *ret;
const char *fmt;
}
static char *
-statval (which, fname, flags, fmt, sp)
- int which;
- char *fname;
- int flags;
- char *fmt;
- struct stat *sp;
+statval (int which, char *fname, int flags, char *fmt, struct stat *sp)
{
int temp;
}
static int
-loadstat (vname, var, fname, flags, fmt, sp)
- char *vname;
- SHELL_VAR *var;
- char *fname;
- int flags;
- char *fmt;
- struct stat *sp;
+loadstat (char *vname, SHELL_VAR *var, char *fname, int flags, char *fmt, struct stat *sp)
{
int i;
char *key, *value;
}
int
-stat_builtin (list)
- WORD_LIST *list;
+stat_builtin (WORD_LIST *list)
{
int opt, flags;
char *aname, *fname, *timefmt;
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#include "bashgetopt.h"
int
-strftime_builtin (list)
- WORD_LIST *list;
+strftime_builtin (WORD_LIST *list)
{
char *format, *tbuf;
size_t tbsize, tsize;
/* sync - sync the disks by forcing pending filesystem writes to complete */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#endif
int
-sync_builtin (list)
- WORD_LIST *list;
+sync_builtin (WORD_LIST *list)
{
int fd, status;
WORD_LIST *l;
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2021 Free Software Foundation, Inc.
+ Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
extern char *strerror ();
int
-tee_builtin (list)
- WORD_LIST *list;
+tee_builtin (WORD_LIST *list)
{
int opt, append, nointr, rval, fd, fflags;
int n, nr, nw;
extern int errno;
#endif
-extern char *strerror ();
+extern char *strerror (int);
int
-template_builtin (list)
- WORD_LIST *list;
+template_builtin (WORD_LIST *list)
{
int opt, rval;
/* Called when `template' is enabled and loaded from the shared object. If this
function returns 0, the load fails. */
int
-template_builtin_load (name)
- char *name;
+template_builtin_load (char *name)
{
return (1);
}
/* Called when `template' is disabled. */
void
-template_builtin_unload (name)
- char *name;
+template_builtin_unload (char *name)
{
}
/* true and false builtins */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#include "common.h"
int
-true_builtin (list)
- WORD_LIST *list;
+true_builtin (WORD_LIST *list)
{
return EXECUTION_SUCCESS;
}
int
-false_builtin (list)
- WORD_LIST *list;
+false_builtin (WORD_LIST *list)
{
return EXECUTION_FAILURE;
}
/* See Makefile for compilation details. */
/*
- Copyright (C) 1999-2021 Free Software Foundation, Inc.
+ Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
extern char *ttyname ();
int
-tty_builtin (list)
- WORD_LIST *list;
+tty_builtin (WORD_LIST *list)
{
int opt, sflag;
char *t;
*/
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
extern int errno;
#endif
-static void uprint();
+static void uprint(int, char *);
static int uname_flags;
int
-uname_builtin (list)
- WORD_LIST *list;
+uname_builtin (WORD_LIST *list)
{
int opt, r;
struct utsname uninfo;
}
static void
-uprint (flag, info)
- int flag;
- char *info;
+uprint (int flag, char *info)
{
if (uname_flags & flag)
{
fsck clean up the file system. */
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#endif
int
-unlink_builtin (list)
- WORD_LIST *list;
+unlink_builtin (WORD_LIST *list)
{
if (list == 0)
{
*/
/*
- Copyright (C) 1999-2009 Free Software Foundation, Inc.
+ Copyright (C) 1999-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
#include "common.h"
int
-whoami_builtin (list)
- WORD_LIST *list;
+whoami_builtin (WORD_LIST *list)
{
int opt;
/* execute_cmd.h - functions from execute_cmd.c. */
-/* Copyright (C) 1993-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2017,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Functions declared in execute_cmd.c, used by many other files */
-extern struct fd_bitmap *new_fd_bitmap PARAMS((int));
-extern void dispose_fd_bitmap PARAMS((struct fd_bitmap *));
-extern void close_fd_bitmap PARAMS((struct fd_bitmap *));
-extern int executing_line_number PARAMS((void));
-extern int execute_command PARAMS((COMMAND *));
-extern int execute_command_internal PARAMS((COMMAND *, int, int, int, struct fd_bitmap *));
-extern int shell_execve PARAMS((char *, char **, char **));
-extern void setup_async_signals PARAMS((void));
-extern void async_redirect_stdin PARAMS((void));
+extern struct fd_bitmap *new_fd_bitmap (int);
+extern void dispose_fd_bitmap (struct fd_bitmap *);
+extern void close_fd_bitmap (struct fd_bitmap *);
+extern int executing_line_number (void);
+extern int execute_command (COMMAND *);
+extern int execute_command_internal (COMMAND *, int, int, int, struct fd_bitmap *);
+extern int shell_execve (char *, char **, char **);
+extern void setup_async_signals (void);
+extern void async_redirect_stdin (void);
-extern void undo_partial_redirects PARAMS((void));
-extern void dispose_partial_redirects PARAMS((void));
-extern void dispose_exec_redirects PARAMS((void));
+extern void undo_partial_redirects (void);
+extern void dispose_partial_redirects (void);
+extern void dispose_exec_redirects (void);
-extern int execute_shell_function PARAMS((SHELL_VAR *, WORD_LIST *));
+extern int execute_shell_function (SHELL_VAR *, WORD_LIST *);
-extern struct coproc *getcoprocbypid PARAMS((pid_t));
-extern struct coproc *getcoprocbyname PARAMS((const char *));
+extern struct coproc *getcoprocbypid (pid_t);
+extern struct coproc *getcoprocbyname (const char *);
-extern void coproc_init PARAMS((struct coproc *));
-extern struct coproc *coproc_alloc PARAMS((char *, pid_t));
-extern void coproc_dispose PARAMS((struct coproc *));
-extern void coproc_flush PARAMS((void));
-extern void coproc_close PARAMS((struct coproc *));
-extern void coproc_closeall PARAMS((void));
-extern void coproc_reap PARAMS((void));
-extern pid_t coproc_active PARAMS((void));
+extern void coproc_init (struct coproc *);
+extern struct coproc *coproc_alloc (char *, pid_t);
+extern void coproc_dispose (struct coproc *);
+extern void coproc_flush (void);
+extern void coproc_close (struct coproc *);
+extern void coproc_closeall (void);
+extern void coproc_reap (void);
+extern pid_t coproc_active (void);
-extern void coproc_rclose PARAMS((struct coproc *, int));
-extern void coproc_wclose PARAMS((struct coproc *, int));
-extern void coproc_fdclose PARAMS((struct coproc *, int));
+extern void coproc_rclose (struct coproc *, int);
+extern void coproc_wclose (struct coproc *, int);
+extern void coproc_fdclose (struct coproc *, int);
-extern void coproc_checkfd PARAMS((struct coproc *, int));
-extern void coproc_fdchk PARAMS((int));
+extern void coproc_checkfd (struct coproc *, int);
+extern void coproc_fdchk (int);
-extern void coproc_pidchk PARAMS((pid_t, int));
+extern void coproc_pidchk (pid_t, int);
-extern void coproc_fdsave PARAMS((struct coproc *));
-extern void coproc_fdrestore PARAMS((struct coproc *));
+extern void coproc_fdsave (struct coproc *);
+extern void coproc_fdrestore (struct coproc *);
-extern void coproc_setvars PARAMS((struct coproc *));
-extern void coproc_unsetvars PARAMS((struct coproc *));
+extern void coproc_setvars (struct coproc *);
+extern void coproc_unsetvars (struct coproc *);
#if defined (PROCESS_SUBSTITUTION)
-extern void close_all_files PARAMS((void));
+extern void close_all_files (void);
#endif
#if defined (ARRAY_VARS)
-extern void restore_funcarray_state PARAMS((struct func_array_state *));
+extern void restore_funcarray_state (struct func_array_state *);
#endif
#endif /* _EXECUTE_CMD_H_ */
/* externs.h -- extern function declarations which do not appear in their
own header file. */
-/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Functions from expr.c. */
#define EXP_EXPANDED 0x01
-extern intmax_t evalexp PARAMS((char *, int, int *));
+extern intmax_t evalexp (char *, int, int *);
/* Functions from print_cmd.c. */
#define FUNC_MULTILINE 0x01
#define FUNC_EXTERNAL 0x02
-extern char *make_command_string PARAMS((COMMAND *));
-extern char *print_comsub PARAMS((COMMAND *));
-extern char *named_function_string PARAMS((char *, COMMAND *, int));
+extern char *make_command_string (COMMAND *);
+extern char *print_comsub (COMMAND *);
+extern char *named_function_string (char *, COMMAND *, int);
-extern void print_command PARAMS((COMMAND *));
-extern void print_simple_command PARAMS((SIMPLE_COM *));
-extern void print_word_list PARAMS((WORD_LIST *, char *));
+extern void print_command (COMMAND *);
+extern void print_simple_command (SIMPLE_COM *);
+extern void print_word_list (WORD_LIST *, char *);
/* debugger support */
-extern void print_for_command_head PARAMS((FOR_COM *));
+extern void print_for_command_head (FOR_COM *);
#if defined (SELECT_COMMAND)
-extern void print_select_command_head PARAMS((SELECT_COM *));
+extern void print_select_command_head (SELECT_COM *);
#endif
-extern void print_case_command_head PARAMS((CASE_COM *));
+extern void print_case_command_head (CASE_COM *);
#if defined (DPAREN_ARITHMETIC)
-extern void print_arith_command PARAMS((WORD_LIST *));
+extern void print_arith_command (WORD_LIST *);
#endif
#if defined (COND_COMMAND)
-extern void print_cond_command PARAMS((COND_COM *));
+extern void print_cond_command (COND_COM *);
#endif
/* set -x support */
-extern void xtrace_init PARAMS((void));
+extern void xtrace_init (void);
#ifdef NEED_XTRACE_SET_DECL
-extern void xtrace_set PARAMS((int, FILE *));
-#endif
-extern void xtrace_fdchk PARAMS((int));
-extern void xtrace_reset PARAMS((void));
-extern char *indirection_level_string PARAMS((void));
-extern void xtrace_print_assignment PARAMS((char *, char *, int, int));
-extern void xtrace_print_word_list PARAMS((WORD_LIST *, int));
-extern void xtrace_print_for_command_head PARAMS((FOR_COM *));
+extern void xtrace_set (int, FILE *);
+#endif
+extern void xtrace_fdchk (int);
+extern void xtrace_reset (void);
+extern char *indirection_level_string (void);
+extern void xtrace_print_assignment (char *, char *, int, int);
+extern void xtrace_print_word_list (WORD_LIST *, int);
+extern void xtrace_print_for_command_head (FOR_COM *);
#if defined (SELECT_COMMAND)
-extern void xtrace_print_select_command_head PARAMS((SELECT_COM *));
+extern void xtrace_print_select_command_head (SELECT_COM *);
#endif
-extern void xtrace_print_case_command_head PARAMS((CASE_COM *));
+extern void xtrace_print_case_command_head (CASE_COM *);
#if defined (DPAREN_ARITHMETIC)
-extern void xtrace_print_arith_cmd PARAMS((WORD_LIST *));
+extern void xtrace_print_arith_cmd (WORD_LIST *);
#endif
#if defined (COND_COMMAND)
-extern void xtrace_print_cond_term PARAMS((int, int, WORD_DESC *, char *, char *));
+extern void xtrace_print_cond_term (int, int, WORD_DESC *, char *, char *);
#endif
/* Functions from shell.c. */
-extern void exit_shell PARAMS((int)) __attribute__((__noreturn__));
-extern void sh_exit PARAMS((int)) __attribute__((__noreturn__));
-extern void subshell_exit PARAMS((int)) __attribute__((__noreturn__));
-extern void set_exit_status PARAMS((int));
-extern void disable_priv_mode PARAMS((void));
-extern void unbind_args PARAMS((void));
+extern void exit_shell (int) __attribute__((__noreturn__));
+extern void sh_exit (int) __attribute__((__noreturn__));
+extern void subshell_exit (int) __attribute__((__noreturn__));
+extern void set_exit_status (int);
+extern void disable_priv_mode (void);
+extern void unbind_args (void);
#if defined (RESTRICTED_SHELL)
-extern int shell_is_restricted PARAMS((char *));
-extern int maybe_make_restricted PARAMS((char *));
+extern int shell_is_restricted (char *);
+extern int maybe_make_restricted (char *);
#endif
-extern void unset_bash_input PARAMS((int));
-extern void get_current_user_info PARAMS((void));
+extern void unset_bash_input (int);
+extern void get_current_user_info (void);
/* Functions from eval.c. */
-extern int reader_loop PARAMS((void));
-extern int pretty_print_loop PARAMS((void));
-extern int parse_command PARAMS((void));
-extern int read_command PARAMS((void));
+extern int reader_loop (void);
+extern int pretty_print_loop (void);
+extern int parse_command (void);
+extern int read_command (void);
/* Functions from braces.c. */
#if defined (BRACE_EXPANSION)
-extern char **brace_expand PARAMS((char *));
+extern char **brace_expand (char *);
#endif
/* Miscellaneous functions from parse.y */
-extern int yyparse PARAMS((void));
-extern int return_EOF PARAMS((void));
-extern void push_token PARAMS((int));
-extern char *xparse_dolparen PARAMS((char *, char *, int *, int));
-extern COMMAND *parse_string_to_command PARAMS((char *, int));
-extern void reset_parser PARAMS((void));
-extern void reset_readahead_token PARAMS((void));
-extern WORD_LIST *parse_string_to_word_list PARAMS((char *, int, const char *));
+extern int yyparse (void);
+extern int return_EOF (void);
+extern void push_token (int);
+extern char *xparse_dolparen (char *, char *, int *, int);
+extern COMMAND *parse_string_to_command (char *, int);
+extern void reset_parser (void);
+extern void reset_readahead_token (void);
+extern WORD_LIST *parse_string_to_word_list (char *, int, const char *);
-extern int parser_will_prompt PARAMS((void));
-extern int parser_in_command_position PARAMS((void));
+extern int parser_will_prompt (void);
+extern int parser_in_command_position (void);
-extern void free_pushed_string_input PARAMS((void));
+extern void free_pushed_string_input (void);
-extern int parser_expanding_alias PARAMS((void));
-extern void parser_save_alias PARAMS((void));
-extern void parser_restore_alias PARAMS((void));
+extern int parser_expanding_alias (void);
+extern void parser_save_alias (void);
+extern void parser_restore_alias (void);
-extern void clear_shell_input_line PARAMS((void));
+extern void clear_shell_input_line (void);
-extern char *decode_prompt_string PARAMS((char *));
+extern char *decode_prompt_string (char *);
-extern int get_current_prompt_level PARAMS((void));
-extern void set_current_prompt_level PARAMS((int));
+extern int get_current_prompt_level (void);
+extern void set_current_prompt_level (int);
#if defined (HISTORY)
-extern char *history_delimiting_chars PARAMS((const char *));
+extern char *history_delimiting_chars (const char *);
#endif
/* Declarations for functions defined in locale.c */
-extern void set_default_locale PARAMS((void));
-extern void set_default_locale_vars PARAMS((void));
-extern int set_locale_var PARAMS((char *, char *));
-extern int set_lang PARAMS((char *, char *));
-extern void set_default_lang PARAMS((void));
-extern char *get_locale_var PARAMS((char *));
-extern char *localetrans PARAMS((char *, int, int *));
-extern char *mk_msgstr PARAMS((char *, int *));
-extern char *locale_expand PARAMS((char *, int, int, int, int *));
+extern void set_default_locale (void);
+extern void set_default_locale_vars (void);
+extern int set_locale_var (char *, char *);
+extern int set_lang (char *, char *);
+extern void set_default_lang (void);
+extern char *get_locale_var (char *);
+extern char *localetrans (char *, int, int *);
+extern char *mk_msgstr (char *, int *);
+extern char *locale_expand (char *, int, int, int, int *);
#ifndef locale_decpoint
-extern int locale_decpoint PARAMS((void));
+extern int locale_decpoint (void);
#endif
/* Declarations for functions defined in list.c. */
-extern void list_walk PARAMS((GENERIC_LIST *, sh_glist_func_t *));
-extern void wlist_walk PARAMS((WORD_LIST *, sh_icpfunc_t *));
+extern void list_walk (GENERIC_LIST *, sh_glist_func_t *);
+extern void wlist_walk (WORD_LIST *, sh_icpfunc_t *);
+/* type punning used to pass arbitrary list types to list_reverse, et al so
+ there are no prototypes. */
extern GENERIC_LIST *list_reverse ();
extern int list_length ();
extern GENERIC_LIST *list_append ();
-extern GENERIC_LIST *list_remove ();
+extern GENERIC_LIST *list_remove (); /* unused */
/* Declarations for functions defined in stringlib.c */
-extern int find_string_in_alist PARAMS((char *, STRING_INT_ALIST *, int));
-extern char *find_token_in_alist PARAMS((int, STRING_INT_ALIST *, int));
-extern int find_index_in_alist PARAMS((char *, STRING_INT_ALIST *, int));
+extern int find_string_in_alist (char *, STRING_INT_ALIST *, int);
+extern char *find_token_in_alist (int, STRING_INT_ALIST *, int);
+extern int find_index_in_alist (char *, STRING_INT_ALIST *, int);
-extern char *substring PARAMS((const char *, int, int));
-extern char *strsub PARAMS((char *, char *, char *, int));
-extern char *strcreplace PARAMS((char *, int, const char *, int));
-extern void strip_leading PARAMS((char *));
-extern void strip_trailing PARAMS((char *, int, int));
-extern void xbcopy PARAMS((char *, char *, int));
+extern char *substring (const char *, int, int);
+extern char *strsub (char *, char *, char *, int);
+extern char *strcreplace (char *, int, const char *, int);
+extern void strip_leading (char *);
+extern void strip_trailing (char *, int, int);
+extern void xbcopy (char *, char *, int);
/* Functions from version.c. */
-extern char *shell_version_string PARAMS((void));
-extern void show_shell_version PARAMS((int));
+extern char *shell_version_string (void);
+extern void show_shell_version (int);
/* Functions from the bash library, lib/sh/libsh.a. These should really
go into a separate include file. */
/* declarations for functions defined in lib/sh/casemod.c */
-extern char *sh_modcase PARAMS((const char *, char *, int));
+extern char *sh_modcase (const char *, char *, int);
/* Defines for flags argument to sh_modcase. These need to agree with what's
in lib/sh/casemode.c */
#define CASE_USEWORDS 0x1000
/* declarations for functions defined in lib/sh/clktck.c */
-extern long get_clk_tck PARAMS((void));
+extern long get_clk_tck (void);
/* declarations for functions defined in lib/sh/clock.c */
+/* No prototypes so we don't have to have clock_t defined when this file
+ is included. */
extern void clock_t_to_secs ();
extern void print_clock_t ();
/* Declarations for functions defined in lib/sh/dprintf.c */
#if !defined (HAVE_DPRINTF)
-extern void dprintf PARAMS((int, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
+extern void dprintf (int, const char *, ...)) __attribute__((__format__ (printf, 2, 3));
#endif
/* Declarations for functions defined in lib/sh/fmtulong.c */
#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 *fmtulong (unsigned long int, int, char *, size_t, int);
/* Declarations for functions defined in lib/sh/fmtulong.c */
#if defined (HAVE_LONG_LONG_INT)
-extern char *fmtullong PARAMS((unsigned long long int, int, char *, size_t, int));
+extern char *fmtullong (unsigned long long int, int, char *, size_t, int);
#endif
/* Declarations for functions defined in lib/sh/fmtumax.c */
-extern char *fmtumax PARAMS((uintmax_t, int, char *, size_t, int));
+extern char *fmtumax (uintmax_t, int, char *, size_t, int);
/* Declarations for functions defined in lib/sh/fnxform.c */
-extern char *fnx_fromfs PARAMS((char *, size_t));
-extern char *fnx_tofs PARAMS((char *, size_t));
+extern char *fnx_fromfs (char *, size_t);
+extern char *fnx_tofs (char *, size_t);
/* Declarations for functions defined in lib/sh/fpurge.c */
#if HAVE_FPURGE
# define fpurge _bash_fpurge
#endif
-extern int fpurge PARAMS((FILE *stream));
+extern int fpurge (FILE *stream);
#endif /* HAVE_DECL_FPURGE */
#endif /* NEED_FPURGE_DECL */
/* Declarations for functions defined in lib/sh/getcwd.c */
#if !defined (HAVE_GETCWD)
-extern char *getcwd PARAMS((char *, size_t));
+extern char *getcwd (char *, size_t);
#endif
/* Declarations for functions defined in lib/sh/input_avail.c */
-extern int input_avail PARAMS((int));
+extern int input_avail (int);
/* Declarations for functions defined in lib/sh/itos.c */
-extern char *inttostr PARAMS((intmax_t, char *, size_t));
-extern char *itos PARAMS((intmax_t));
-extern char *mitos PARAMS((intmax_t));
-extern char *uinttostr PARAMS((uintmax_t, char *, size_t));
-extern char *uitos PARAMS((uintmax_t));
+extern char *inttostr (intmax_t, char *, size_t);
+extern char *itos (intmax_t);
+extern char *mitos (intmax_t);
+extern char *uinttostr (uintmax_t, char *, size_t);
+extern char *uitos (uintmax_t);
/* declarations for functions defined in lib/sh/makepath.c */
#define MP_DOTILDE 0x01
#define MP_RMDOT 0x04
#define MP_IGNDOT 0x08
-extern char *sh_makepath PARAMS((const char *, const char *, int));
+extern char *sh_makepath (const char *, const char *, int);
/* declarations for functions defined in lib/sh/mbscasecmp.c */
#if !defined (HAVE_MBSCASECMP)
-extern char *mbscasecmp PARAMS((const char *, const char *));
+extern char *mbscasecmp (const char *, const char *);
#endif
/* declarations for functions defined in lib/sh/mbschr.c */
#if !defined (HAVE_MBSCHR)
-extern char *mbschr PARAMS((const char *, int));
+extern char *mbschr (const char *, int);
#endif
/* declarations for functions defined in lib/sh/mbscmp.c */
#if !defined (HAVE_MBSCMP)
-extern char *mbscmp PARAMS((const char *, const char *));
+extern char *mbscmp (const char *, const char *);
#endif
/* declarations for functions defined in lib/sh/netconn.c */
-extern int isnetconn PARAMS((int));
+extern int isnetconn (int);
/* declarations for functions defined in lib/sh/netopen.c */
-extern int netopen PARAMS((char *));
+extern int netopen (char *);
/* Declarations for functions defined in lib/sh/oslib.c */
#if !defined (HAVE_DUP2) || defined (DUP2_BROKEN)
-extern int dup2 PARAMS((int, int));
+extern int dup2 (int, int);
#endif
#if !defined (HAVE_GETDTABLESIZE)
-extern int getdtablesize PARAMS((void));
+extern int getdtablesize (void);
#endif /* !HAVE_GETDTABLESIZE */
#if !defined (HAVE_GETHOSTNAME)
-extern int gethostname PARAMS((char *, int));
+extern int gethostname (char *, int);
#endif /* !HAVE_GETHOSTNAME */
-extern int getmaxgroups PARAMS((void));
-extern long getmaxchild PARAMS((void));
+extern int getmaxgroups (void);
+extern long getmaxchild (void);
/* declarations for functions defined in lib/sh/pathcanon.c */
#define PATH_CHECKDOTDOT 0x0001
#define PATH_HARDPATH 0x0004
#define PATH_NOALLOC 0x0008
-extern char *sh_canonpath PARAMS((char *, int));
+extern char *sh_canonpath (char *, int);
/* declarations for functions defined in lib/sh/pathphys.c */
-extern char *sh_physpath PARAMS((char *, int));
-extern char *sh_realpath PARAMS((const char *, char *));
+extern char *sh_physpath (char *, int);
+extern char *sh_realpath (const char *, char *);
/* declarations for functions defined in lib/sh/random.c */
-extern int brand PARAMS((void));
-extern void sbrand PARAMS((unsigned long)); /* set bash random number generator. */
-extern void seedrand PARAMS((void)); /* seed generator randomly */
-extern void seedrand32 PARAMS((void));
-extern u_bits32_t get_urandom32 PARAMS((void));
+extern int brand (void);
+extern void sbrand (unsigned long); /* set bash random number generator. */
+extern void seedrand (void); /* seed generator randomly */
+extern void seedrand32 (void);
+extern u_bits32_t get_urandom32 (void);
/* declarations for functions defined in lib/sh/setlinebuf.c */
#ifdef NEED_SH_SETLINEBUF_DECL
-extern int sh_setlinebuf PARAMS((FILE *));
+extern int sh_setlinebuf (FILE *);
#endif
/* declarations for functions defined in lib/sh/shaccess.c */
-extern int sh_eaccess PARAMS((const char *, int));
+extern int sh_eaccess (const char *, int);
/* declarations for functions defined in lib/sh/shmatch.c */
-extern int sh_regmatch PARAMS((const char *, const char *, int));
+extern int sh_regmatch (const char *, const char *, int);
/* defines for flags argument to sh_regmatch. */
#define SHMAT_SUBEXP 0x001 /* save subexpressions in SH_REMATCH */
#define SHMAT_PWARN 0x002 /* print a warning message on invalid regexp */
/* declarations for functions defined in lib/sh/shmbchar.c */
-extern size_t mbstrlen PARAMS((const char *));
-extern char *mbsmbchar PARAMS((const char *));
-extern int sh_mbsnlen PARAMS((const char *, size_t, int));
+extern size_t mbstrlen (const char *);
+extern char *mbsmbchar (const char *);
+extern int sh_mbsnlen (const char *, size_t, int);
/* declarations for functions defined in lib/sh/shquote.c */
-extern char *sh_single_quote PARAMS((const char *));
-extern char *sh_double_quote PARAMS((const char *));
-extern char *sh_mkdoublequoted PARAMS((const char *, int, int));
-extern char *sh_un_double_quote PARAMS((char *));
-extern char *sh_backslash_quote PARAMS((char *, const char *, int));
-extern char *sh_backslash_quote_for_double_quotes PARAMS((char *, int));
-extern char *sh_quote_reusable PARAMS((char *, int));
-extern int sh_contains_shell_metas PARAMS((const char *));
-extern int sh_contains_quotes PARAMS((const char *));
+extern char *sh_single_quote (const char *);
+extern char *sh_double_quote (const char *);
+extern char *sh_mkdoublequoted (const char *, int, int);
+extern char *sh_un_double_quote (char *);
+extern char *sh_backslash_quote (char *, const char *, int);
+extern char *sh_backslash_quote_for_double_quotes (char *, int);
+extern char *sh_quote_reusable (char *, int);
+extern int sh_contains_shell_metas (const char *);
+extern int sh_contains_quotes (const char *);
/* declarations for functions defined in lib/sh/spell.c */
-extern int spname PARAMS((char *, char *));
-extern char *dirspell PARAMS((char *));
+extern int spname (char *, char *);
+extern char *dirspell (char *);
/* declarations for functions defined in lib/sh/strcasecmp.c */
#if !defined (HAVE_STRCASECMP)
-extern int strncasecmp PARAMS((const char *, const char *, size_t));
-extern int strcasecmp PARAMS((const char *, const char *));
+extern int strncasecmp (const char *, const char *, size_t);
+extern int strcasecmp (const char *, const char *);
#endif /* HAVE_STRCASECMP */
/* declarations for functions defined in lib/sh/strcasestr.c */
#if ! HAVE_STRCASESTR
-extern char *strcasestr PARAMS((const char *, const char *));
+extern char *strcasestr (const char *, const char *);
#endif
/* declarations for functions defined in lib/sh/strchrnul.c */
#if ! HAVE_STRCHRNUL
-extern char *strchrnul PARAMS((const char *, int));
+extern char *strchrnul (const char *, int);
#endif
/* declarations for functions defined in lib/sh/strerror.c */
#if !defined (HAVE_STRERROR) && !defined (strerror)
-extern char *strerror PARAMS((int));
+extern char *strerror (int);
#endif
/* declarations for functions defined in lib/sh/strftime.c */
#if !defined (HAVE_STRFTIME) && defined (NEED_STRFTIME_DECL)
-extern size_t strftime PARAMS((char *, size_t, const char *, const struct tm *));
+extern size_t strftime (char *, size_t, const char *, const struct tm *);
#endif
/* declarations for functions and structures defined in lib/sh/stringlist.c */
int list_len;
} STRINGLIST;
-typedef int sh_strlist_map_func_t PARAMS((char *));
-
-extern STRINGLIST *strlist_create PARAMS((int));
-extern STRINGLIST *strlist_resize PARAMS((STRINGLIST *, int));
-extern void strlist_flush PARAMS((STRINGLIST *));
-extern void strlist_dispose PARAMS((STRINGLIST *));
-extern int strlist_remove PARAMS((STRINGLIST *, char *));
-extern STRINGLIST *strlist_copy PARAMS((STRINGLIST *));
-extern STRINGLIST *strlist_merge PARAMS((STRINGLIST *, STRINGLIST *));
-extern STRINGLIST *strlist_append PARAMS((STRINGLIST *, STRINGLIST *));
-extern STRINGLIST *strlist_prefix_suffix PARAMS((STRINGLIST *, char *, char *));
-extern void strlist_print PARAMS((STRINGLIST *, char *));
-extern void strlist_walk PARAMS((STRINGLIST *, sh_strlist_map_func_t *));
-extern void strlist_sort PARAMS((STRINGLIST *));
+typedef int sh_strlist_map_func_t (char *);
+
+extern STRINGLIST *strlist_create (int);
+extern STRINGLIST *strlist_resize (STRINGLIST *, int);
+extern void strlist_flush (STRINGLIST *);
+extern void strlist_dispose (STRINGLIST *);
+extern int strlist_remove (STRINGLIST *, char *);
+extern STRINGLIST *strlist_copy (STRINGLIST *);
+extern STRINGLIST *strlist_merge (STRINGLIST *, STRINGLIST *);
+extern STRINGLIST *strlist_append (STRINGLIST *, STRINGLIST *);
+extern STRINGLIST *strlist_prefix_suffix (STRINGLIST *, char *, char *);
+extern void strlist_print (STRINGLIST *, char *);
+extern void strlist_walk (STRINGLIST *, sh_strlist_map_func_t *);
+extern void strlist_sort (STRINGLIST *);
/* declarations for functions defined in lib/sh/stringvec.c */
-extern char **strvec_create PARAMS((int));
-extern char **strvec_resize PARAMS((char **, int));
-extern char **strvec_mcreate PARAMS((int));
-extern char **strvec_mresize PARAMS((char **, int));
-extern void strvec_flush PARAMS((char **));
-extern void strvec_dispose PARAMS((char **));
-extern int strvec_remove PARAMS((char **, char *));
-extern int strvec_len PARAMS((char **));
-extern int strvec_search PARAMS((char **, char *));
-extern char **strvec_copy PARAMS((char **));
-extern int strvec_posixcmp PARAMS((char **, char **));
-extern int strvec_strcmp PARAMS((char **, char **));
-extern void strvec_sort PARAMS((char **, int));
-
-extern char **strvec_from_word_list PARAMS((WORD_LIST *, int, int, int *));
-extern WORD_LIST *strvec_to_word_list PARAMS((char **, int, int));
+extern char **strvec_create (int);
+extern char **strvec_resize (char **, int);
+extern char **strvec_mcreate (int);
+extern char **strvec_mresize (char **, int);
+extern void strvec_flush (char **);
+extern void strvec_dispose (char **);
+extern int strvec_remove (char **, char *);
+extern int strvec_len (char **);
+extern int strvec_search (char **, char *);
+extern char **strvec_copy (char **);
+extern int strvec_posixcmp (char **, char **);
+extern int strvec_strcmp (char **, char **);
+extern void strvec_sort (char **, int);
+
+extern char **strvec_from_word_list (WORD_LIST *, int, int, int *);
+extern WORD_LIST *strvec_to_word_list (char **, int, int);
/* declarations for functions defined in lib/sh/strnlen.c */
#if !defined (HAVE_STRNLEN)
-extern size_t strnlen PARAMS((const char *, size_t));
+extern size_t strnlen (const char *, size_t);
#endif
/* declarations for functions defined in lib/sh/strpbrk.c */
#if !defined (HAVE_STRPBRK)
-extern char *strpbrk PARAMS((const char *, const char *));
+extern char *strpbrk (const char *, const char *);
#endif
/* declarations for functions defined in lib/sh/strtod.c */
#if !defined (HAVE_STRTOD)
-extern double strtod PARAMS((const char *, char **));
+extern double strtod (const char *, char **);
#endif
/* declarations for functions defined in lib/sh/strtol.c */
#if !HAVE_DECL_STRTOL
-extern long strtol PARAMS((const char *, char **, int));
+extern long strtol (const char *, char **, int);
#endif
/* declarations for functions defined in lib/sh/strtoll.c */
#if defined (HAVE_LONG_LONG_INT) && !HAVE_DECL_STRTOLL
-extern long long strtoll PARAMS((const char *, char **, int));
+extern long long strtoll (const char *, char **, int);
#endif
/* declarations for functions defined in lib/sh/strtoul.c */
#if !HAVE_DECL_STRTOUL
-extern unsigned long strtoul PARAMS((const char *, char **, int));
+extern unsigned long strtoul (const char *, char **, int);
#endif
/* declarations for functions defined in lib/sh/strtoull.c */
#if defined (HAVE_UNSIGNED_LONG_LONG_INT) && !HAVE_DECL_STRTOULL
-extern unsigned long long strtoull PARAMS((const char *, char **, int));
+extern unsigned long long strtoull (const char *, char **, int);
#endif
/* declarations for functions defined in lib/sh/strimax.c */
#if !HAVE_DECL_STRTOIMAX
-extern intmax_t strtoimax PARAMS((const char *, char **, int));
+extern intmax_t strtoimax (const char *, char **, int);
#endif
/* declarations for functions defined in lib/sh/strumax.c */
#if !HAVE_DECL_STRTOUMAX
-extern uintmax_t strtoumax PARAMS((const char *, char **, int));
+extern uintmax_t strtoumax (const char *, char **, int);
#endif
/* declarations for functions defined in lib/sh/strtrans.c */
-extern char *ansicstr PARAMS((char *, int, int, int *, int *));
-extern char *ansic_quote PARAMS((char *, int, int *));
-extern int ansic_shouldquote PARAMS((const char *));
-extern char *ansiexpand PARAMS((char *, int, int, int *));
+extern char *ansicstr (char *, int, int, int *, int *);
+extern char *ansic_quote (char *, int, int *);
+extern int ansic_shouldquote (const char *);
+extern char *ansiexpand (char *, int, int, int *);
/* declarations for functions defined in lib/sh/strvis.c */
-extern int sh_charvis PARAMS((const char *, size_t *, size_t, char *, size_t *));
-extern char *sh_strvis PARAMS((const char *));
+extern int sh_charvis (const char *, size_t *, size_t, char *, size_t *);
+extern char *sh_strvis (const char *);
/* declarations for functions defined in lib/sh/timeval.c. No prototypes
so we don't have to count on having a definition of struct timeval in
#define MT_USERANDOM 0x0004
#define MT_TEMPLATE 0x0008
-extern char *sh_mktmpname PARAMS((char *, int));
-extern int sh_mktmpfd PARAMS((char *, int, char **));
-/* extern FILE *sh_mktmpfp PARAMS((char *, int, char **)); */
-extern char *sh_mktmpdir PARAMS((char *, int));
+extern char *sh_mktmpname (char *, int);
+extern int sh_mktmpfd (char *, int, char **);
+/* extern FILE *sh_mktmpfp (char *, int, char **); */
+extern char *sh_mktmpdir (char *, int);
/* declarations for functions defined in lib/sh/uconvert.c */
-extern int uconvert PARAMS((char *, long *, long *, char **));
+extern int uconvert (char *, long *, long *, char **);
/* declarations for functions defined in lib/sh/ufuncs.c */
-extern unsigned int falarm PARAMS((unsigned int, unsigned int));
-extern unsigned int fsleep PARAMS((unsigned int, unsigned int));
+extern unsigned int falarm (unsigned int, unsigned int);
+extern unsigned int fsleep (unsigned int, unsigned int);
/* declarations for functions defined in lib/sh/unicode.c */
-extern int u32cconv PARAMS((unsigned long, char *));
-extern void u32reset PARAMS((void));
+extern int u32cconv (unsigned long, char *);
+extern void u32reset (void);
/* declarations for functions defined in lib/sh/utf8.c */
-extern char *utf8_mbschr PARAMS((const char *, int));
-extern int utf8_mbscmp PARAMS((const char *, const char *));
-extern char *utf8_mbsmbchar PARAMS((const char *));
-extern int utf8_mbsnlen PARAMS((const char *, size_t, int));
-extern int utf8_mblen PARAMS((const char *, size_t));
-extern size_t utf8_mbstrlen PARAMS((const char *));
+extern char *utf8_mbschr (const char *, int);
+extern int utf8_mbscmp (const char *, const char *);
+extern char *utf8_mbsmbchar (const char *);
+extern int utf8_mbsnlen (const char *, size_t, int);
+extern int utf8_mblen (const char *, size_t);
+extern size_t utf8_mbstrlen (const char *);
/* declarations for functions defined in lib/sh/wcsnwidth.c */
#if defined (HANDLE_MULTIBYTE)
-extern int wcsnwidth PARAMS((const wchar_t *, size_t, int));
+extern int wcsnwidth (const wchar_t *, size_t, int);
#endif
/* declarations for functions defined in lib/sh/winsize.c */
-extern void get_new_window_size PARAMS((int, int *, int *));
+extern void get_new_window_size (int, int *, int *);
/* declarations for functions defined in lib/sh/zcatfd.c */
-extern int zcatfd PARAMS((int, int, char *));
+extern int zcatfd (int, int, char *);
/* declarations for functions defined in lib/sh/zgetline.c */
-extern ssize_t zgetline PARAMS((int, char **, size_t *, int, int));
+extern ssize_t zgetline (int, char **, size_t *, int, int);
/* declarations for functions defined in lib/sh/zmapfd.c */
-extern int zmapfd PARAMS((int, char **, char *));
+extern int zmapfd (int, char **, char *);
/* declarations for functions defined in lib/sh/zread.c */
-extern ssize_t zread PARAMS((int, char *, size_t));
-extern ssize_t zreadretry PARAMS((int, char *, size_t));
-extern ssize_t zreadintr PARAMS((int, char *, size_t));
-extern ssize_t zreadc PARAMS((int, char *));
-extern ssize_t zreadcintr PARAMS((int, char *));
-extern ssize_t zreadn PARAMS((int, char *, size_t));
-extern void zreset PARAMS((void));
-extern void zsyncfd PARAMS((int));
+extern ssize_t zread (int, char *, size_t);
+extern ssize_t zreadretry (int, char *, size_t);
+extern ssize_t zreadintr (int, char *, size_t);
+extern ssize_t zreadc (int, char *);
+extern ssize_t zreadcintr (int, char *);
+extern ssize_t zreadn (int, char *, size_t);
+extern void zreset (void);
+extern void zsyncfd (int);
/* declarations for functions defined in lib/sh/zwrite.c */
-extern int zwrite PARAMS((int, char *, size_t));
+extern int zwrite (int, char *, size_t);
/* declarations for functions defined in lib/glob/gmisc.c */
-extern int match_pattern_char PARAMS((char *, char *, int));
-extern int umatchlen PARAMS((char *, size_t));
+extern int match_pattern_char (char *, char *, int);
+extern int umatchlen (char *, size_t);
#if defined (HANDLE_MULTIBYTE)
-extern int match_pattern_wchar PARAMS((wchar_t *, wchar_t *, int));
-extern int wmatchlen PARAMS((wchar_t *, size_t));
+extern int match_pattern_wchar (wchar_t *, wchar_t *, int);
+extern int wmatchlen (wchar_t *, size_t);
#endif
#endif /* _EXTERNS_H_ */
/* findcmd.h - functions from findcmd.c. */
-/* Copyright (C) 1997-2015,2020 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2015,2020-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define CMDSRCH_STDPATH 0x02
#define CMDSRCH_TEMPENV 0x04
-extern int file_status PARAMS((const char *));
-extern int executable_file PARAMS((const char *));
-extern int is_directory PARAMS((const char *));
-extern int executable_or_directory PARAMS((const char *));
-extern char *find_user_command PARAMS((const char *));
-extern char *find_in_path PARAMS((const char *, char *, int));
-extern char *find_path_file PARAMS((const char *));
-extern char *search_for_command PARAMS((const char *, int));
-extern char *user_command_matches PARAMS((const char *, int, int));
-extern void setup_exec_ignore PARAMS((char *));
+extern int file_status (const char *);
+extern int executable_file (const char *);
+extern int is_directory (const char *);
+extern int executable_or_directory (const char *);
+extern char *find_user_command (const char *);
+extern char *find_in_path (const char *, char *, int);
+extern char *find_path_file (const char *);
+extern char *search_for_command (const char *, int);
+extern char *user_command_matches (const char *, int, int);
+extern void setup_exec_ignore (char *);
extern int dot_found_in_search;
/* flags.h -- a list of all the flags that the shell knows about. You add
a flag to this program by adding the name here, and in flags.c. */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int restricted_shell;
#endif /* RESTRICTED_SHELL */
-extern int *find_flag PARAMS((int));
-extern int change_flag PARAMS((int, int));
-extern char *which_set_flags PARAMS((void));
-extern void reset_shell_flags PARAMS((void));
+extern int *find_flag (int);
+extern int change_flag (int, int);
+extern char *which_set_flags (void);
+extern void reset_shell_flags (void);
-extern char *get_current_flags PARAMS((void));
-extern void set_current_flags PARAMS((const char *));
+extern char *get_current_flags (void);
+extern void set_current_flags (const char *);
-extern void initialize_flags PARAMS((void));
+extern void initialize_flags (void);
/* A macro for efficiency. */
#define change_flag_char(flag, on_or_off) change_flag (flag, on_or_off)
/* general.h -- defines that everybody likes to use. */
-/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Hardly used anymore */
#define pointer_to_int(x) (int)((char *)x - (char *)0)
-#if defined (alpha) && defined (__GNUC__) && !defined (strchr) && !defined (__STDC__)
-extern char *strchr (), *strrchr ();
-#endif
-
#if !defined (strcpy) && (defined (HAVE_DECL_STRCPY) && !HAVE_DECL_STRCPY)
-extern char *strcpy PARAMS((char *, const char *));
+extern char *strcpy (char *, const char *);
#endif
#if !defined (savestring)
/* Shell function typedefs with prototypes */
/* `Generic' function pointer typedefs */
-typedef int sh_intfunc_t PARAMS((int));
-typedef int sh_ivoidfunc_t PARAMS((void));
-typedef int sh_icpfunc_t PARAMS((char *));
-typedef int sh_icppfunc_t PARAMS((char **));
-typedef int sh_iptrfunc_t PARAMS((PTR_T));
+typedef int sh_intfunc_t (int);
+typedef int sh_ivoidfunc_t (void);
+typedef int sh_icpfunc_t (char *);
+typedef int sh_icppfunc_t (char **);
+typedef int sh_iptrfunc_t (PTR_T);
-typedef void sh_voidfunc_t PARAMS((void));
-typedef void sh_vintfunc_t PARAMS((int));
-typedef void sh_vcpfunc_t PARAMS((char *));
-typedef void sh_vcppfunc_t PARAMS((char **));
-typedef void sh_vptrfunc_t PARAMS((PTR_T));
+typedef void sh_voidfunc_t (void);
+typedef void sh_vintfunc_t (int);
+typedef void sh_vcpfunc_t (char *);
+typedef void sh_vcppfunc_t (char **);
+typedef void sh_vptrfunc_t (PTR_T);
-typedef int sh_wdesc_func_t PARAMS((WORD_DESC *));
-typedef int sh_wlist_func_t PARAMS((WORD_LIST *));
+typedef int sh_wdesc_func_t (WORD_DESC *);
+typedef int sh_wlist_func_t (WORD_LIST *);
-typedef int sh_glist_func_t PARAMS((GENERIC_LIST *));
+typedef int sh_glist_func_t (GENERIC_LIST *);
+typedef int sh_gcp_func_t (GENERIC_LIST *, char *);
-typedef char *sh_string_func_t PARAMS((char *)); /* like savestring, et al. */
+typedef char *sh_string_func_t (char *); /* like savestring, et al. */
-typedef int sh_msg_func_t PARAMS((const char *, ...)); /* printf(3)-like */
-typedef void sh_vmsg_func_t PARAMS((const char *, ...)); /* printf(3)-like */
+typedef int sh_msg_func_t (const char *, ...); /* printf(3)-like */
+typedef void sh_vmsg_func_t (const char *, ...); /* printf(3)-like */
/* Specific function pointer typedefs. Most of these could be done
with #defines. */
-typedef void sh_sv_func_t PARAMS((char *)); /* sh_vcpfunc_t */
-typedef void sh_free_func_t PARAMS((PTR_T)); /* sh_vptrfunc_t */
-typedef void sh_resetsig_func_t PARAMS((int)); /* sh_vintfunc_t */
+typedef void sh_sv_func_t (char *); /* sh_vcpfunc_t */
+typedef void sh_free_func_t (PTR_T); /* sh_vptrfunc_t */
+typedef void sh_resetsig_func_t (int); /* sh_vintfunc_t */
-typedef int sh_ignore_func_t PARAMS((const char *)); /* sh_icpfunc_t */
+typedef int sh_ignore_func_t (const char *); /* sh_icpfunc_t */
-typedef int sh_assign_func_t PARAMS((const char *));
-typedef int sh_wassign_func_t PARAMS((WORD_DESC *, int));
+typedef int sh_assign_func_t (const char *);
+typedef int sh_wassign_func_t (WORD_DESC *, int);
-typedef int sh_load_func_t PARAMS((char *));
-typedef void sh_unload_func_t PARAMS((char *));
+typedef int sh_load_func_t (char *);
+typedef void sh_unload_func_t (char *);
-typedef int sh_builtin_func_t PARAMS((WORD_LIST *)); /* sh_wlist_func_t */
+typedef int sh_builtin_func_t (WORD_LIST *); /* sh_wlist_func_t */
#endif /* SH_FUNCTION_TYPEDEF */
#if 0
/* Declarations for functions defined in xmalloc.c */
-extern PTR_T xmalloc PARAMS((size_t));
-extern PTR_T xrealloc PARAMS((void *, size_t));
-extern void xfree PARAMS((void *));
+extern PTR_T xmalloc (size_t);
+extern PTR_T xrealloc (void *, size_t);
+extern void xfree (void *);
#endif
/* Declarations for functions defined in general.c */
-extern void posix_initialize PARAMS((int));
+extern void posix_initialize (int);
-extern int num_posix_options PARAMS((void));
-extern char *get_posix_options PARAMS((char *));
-extern void set_posix_options PARAMS((const char *));
+extern int num_posix_options (void);
+extern char *get_posix_options (char *);
+extern void set_posix_options (const char *);
-extern void save_posix_options PARAMS((void));
+extern void save_posix_options (void);
#if defined (RLIMTYPE)
-extern RLIMTYPE string_to_rlimtype PARAMS((char *));
-extern void print_rlimtype PARAMS((RLIMTYPE, int));
+extern RLIMTYPE string_to_rlimtype (char *);
+extern void print_rlimtype (RLIMTYPE, int);
#endif
-extern int all_digits PARAMS((const char *));
-extern int legal_number PARAMS((const char *, intmax_t *));
-extern int legal_identifier PARAMS((const char *));
-extern int importable_function_name PARAMS((const char *, size_t));
-extern int exportable_function_name PARAMS((const char *));
-extern int check_identifier PARAMS((WORD_DESC *, int));
-extern int valid_nameref_value PARAMS((const char *, int));
-extern int check_selfref PARAMS((const char *, char *, int));
-extern int legal_alias_name PARAMS((const char *, int));
-extern int line_isblank PARAMS((const char *));
-extern int assignment PARAMS((const char *, int));
-
-extern int sh_unset_nodelay_mode PARAMS((int));
-extern int sh_setclexec PARAMS((int));
-extern int sh_validfd PARAMS((int));
-extern int fd_ispipe PARAMS((int));
-extern void check_dev_tty PARAMS((void));
-extern int move_to_high_fd PARAMS((int, int, int));
-extern int check_binary_file PARAMS((const char *, int));
+extern int all_digits (const char *);
+extern int legal_number (const char *, intmax_t *);
+extern int legal_identifier (const char *);
+extern int importable_function_name (const char *, size_t);
+extern int exportable_function_name (const char *);
+extern int check_identifier (WORD_DESC *, int);
+extern int valid_nameref_value (const char *, int);
+extern int check_selfref (const char *, char *, int);
+extern int legal_alias_name (const char *, int);
+extern int line_isblank (const char *);
+extern int assignment (const char *, int);
+
+extern int sh_unset_nodelay_mode (int);
+extern int sh_setclexec (int);
+extern int sh_validfd (int);
+extern int fd_ispipe (int);
+extern void check_dev_tty (void);
+extern int move_to_high_fd (int, int, int);
+extern int check_binary_file (const char *, int);
#ifdef _POSIXSTAT_H_
-extern int same_file PARAMS((const char *, const char *, struct stat *, struct stat *));
+extern int same_file (const char *, const char *, struct stat *, struct stat *);
#endif
-extern int sh_openpipe PARAMS((int *));
-extern int sh_closepipe PARAMS((int *));
+extern int sh_openpipe (int *);
+extern int sh_closepipe (int *);
-extern int file_exists PARAMS((const char *));
-extern int file_isdir PARAMS((const char *));
-extern int file_iswdir PARAMS((const char *));
-extern int path_dot_or_dotdot PARAMS((const char *));
-extern int absolute_pathname PARAMS((const char *));
-extern int absolute_program PARAMS((const char *));
+extern int file_exists (const char *);
+extern int file_isdir (const char *);
+extern int file_iswdir (const char *);
+extern int path_dot_or_dotdot (const char *);
+extern int absolute_pathname (const char *);
+extern int absolute_program (const char *);
-extern char *make_absolute PARAMS((const char *, const char *));
-extern char *base_pathname PARAMS((char *));
-extern char *full_pathname PARAMS((char *));
-extern char *polite_directory_format PARAMS((char *));
-extern char *trim_pathname PARAMS((char *, int));
-extern char *printable_filename PARAMS((char *, int));
+extern char *make_absolute (const char *, const char *);
+extern char *base_pathname (char *);
+extern char *full_pathname (char *);
+extern char *polite_directory_format (char *);
+extern char *trim_pathname (char *, int);
+extern char *printable_filename (char *, int);
-extern char *extract_colon_unit PARAMS((char *, int *));
+extern char *extract_colon_unit (char *, int *);
-extern void tilde_initialize PARAMS((void));
-extern char *bash_tilde_find_word PARAMS((const char *, int, int *));
-extern char *bash_tilde_expand PARAMS((const char *, int));
+extern void tilde_initialize (void);
+extern char *bash_tilde_find_word (const char *, int, int *);
+extern char *bash_tilde_expand (const char *, int);
-extern int group_member PARAMS((gid_t));
-extern char **get_group_list PARAMS((int *));
-extern int *get_group_array PARAMS((int *));
+extern int group_member (gid_t);
+extern char **get_group_list (int *);
+extern int *get_group_array (int *);
-extern char *conf_standard_path PARAMS((void));
-extern int default_columns PARAMS((void));
+extern char *conf_standard_path (void);
+extern int default_columns (void);
#endif /* _GENERAL_H_ */
/* hashcmd.h - Common defines for hashing filenames. */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define pathdata(x) ((PATH_DATA *)(x)->data)
-extern void phash_create PARAMS((void));
-extern void phash_flush PARAMS((void));
+extern void phash_create (void);
+extern void phash_flush (void);
-extern void phash_insert PARAMS((char *, char *, int, int));
-extern int phash_remove PARAMS((const char *));
-extern char *phash_search PARAMS((const char *));
+extern void phash_insert (char *, char *, int, int);
+extern int phash_remove (const char *);
+extern char *phash_search (const char *);
/* hashlib.h -- the data structures used in hashing in Bash. */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
int nentries; /* How many entries does this table have. */
} HASH_TABLE;
-typedef int hash_wfunc PARAMS((BUCKET_CONTENTS *));
+typedef int hash_wfunc (BUCKET_CONTENTS *);
/* Operations on tables as a whole */
-extern HASH_TABLE *hash_create PARAMS((int));
-extern HASH_TABLE *hash_copy PARAMS((HASH_TABLE *, sh_string_func_t *));
-extern void hash_flush PARAMS((HASH_TABLE *, sh_free_func_t *));
-extern void hash_dispose PARAMS((HASH_TABLE *));
-extern void hash_walk PARAMS((HASH_TABLE *, hash_wfunc *));
+extern HASH_TABLE *hash_create (int);
+extern HASH_TABLE *hash_copy (HASH_TABLE *, sh_string_func_t *);
+extern void hash_flush (HASH_TABLE *, sh_free_func_t *);
+extern void hash_dispose (HASH_TABLE *);
+extern void hash_walk (HASH_TABLE *, hash_wfunc *);
/* Operations to extract information from or pieces of tables */
-extern int hash_bucket PARAMS((const char *, HASH_TABLE *));
-extern int hash_size PARAMS((HASH_TABLE *));
+extern int hash_bucket (const char *, HASH_TABLE *);
+extern int hash_size (HASH_TABLE *);
/* Operations on hash table entries */
-extern BUCKET_CONTENTS *hash_search PARAMS((const char *, HASH_TABLE *, int));
-extern BUCKET_CONTENTS *hash_insert PARAMS((char *, HASH_TABLE *, int));
-extern BUCKET_CONTENTS *hash_remove PARAMS((const char *, HASH_TABLE *, int));
+extern BUCKET_CONTENTS *hash_search (const char *, HASH_TABLE *, int);
+extern BUCKET_CONTENTS *hash_insert (char *, HASH_TABLE *, int);
+extern BUCKET_CONTENTS *hash_remove (const char *, HASH_TABLE *, int);
/* Miscellaneous */
-extern unsigned int hash_string PARAMS((const char *));
+extern unsigned int hash_string (const char *);
/* Redefine the function as a macro for speed. */
#define hash_items(bucket, table) \
/* input.h -- Structures and unions used for reading input. */
-/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
typedef char **CPPFunction (); /* no longer used */
#endif /* _FUNCTION_DEF */
-typedef int sh_cget_func_t PARAMS((void)); /* sh_ivoidfunc_t */
-typedef int sh_cunget_func_t PARAMS((int)); /* sh_intfunc_t */
+typedef int sh_cget_func_t (void); /* sh_ivoidfunc_t */
+typedef int sh_cunget_func_t (int); /* sh_intfunc_t */
enum stream_type {st_none, st_stdin, st_stream, st_string, st_bstream};
/* Functions from parse.y whose use directly or indirectly depends on the
definitions in this file. */
-extern void initialize_bash_input PARAMS((void));
-extern void init_yy_io PARAMS((sh_cget_func_t *, sh_cunget_func_t *, enum stream_type, const char *, INPUT_STREAM));
-extern char *yy_input_name PARAMS((void));
-extern void with_input_from_stdin PARAMS((void));
-extern void with_input_from_string PARAMS((char *, const char *));
-extern void with_input_from_stream PARAMS((FILE *, const char *));
-extern void push_stream PARAMS((int));
-extern void pop_stream PARAMS((void));
-extern int stream_on_stack PARAMS((enum stream_type));
-extern char *read_secondary_line PARAMS((int));
-extern int find_reserved_word PARAMS((char *));
-extern void gather_here_documents PARAMS((void));
-extern void execute_variable_command PARAMS((char *, char *));
-
-extern int *save_token_state PARAMS((void));
-extern void restore_token_state PARAMS((int *));
+extern void initialize_bash_input (void);
+extern void init_yy_io (sh_cget_func_t *, sh_cunget_func_t *, enum stream_type, const char *, INPUT_STREAM);
+extern char *yy_input_name (void);
+extern void with_input_from_stdin (void);
+extern void with_input_from_string (char *, const char *);
+extern void with_input_from_stream (FILE *, const char *);
+extern void push_stream (int);
+extern void pop_stream (void);
+extern int stream_on_stack (enum stream_type);
+extern char *read_secondary_line (int);
+extern int find_reserved_word (char *);
+extern void gather_here_documents (void);
+extern void execute_variable_command (char *, char *);
+
+extern int *save_token_state (void);
+extern void restore_token_state (int *);
/* Functions from input.c */
-extern int getc_with_restart PARAMS((FILE *));
-extern int ungetc_with_restart PARAMS((int, FILE *));
+extern int getc_with_restart (FILE *);
+extern int ungetc_with_restart (int, FILE *);
#if defined (BUFFERED_INPUT)
/* Functions from input.c. */
-extern int fd_is_bash_input PARAMS((int));
-extern int set_bash_input_fd PARAMS((int));
-extern int save_bash_input PARAMS((int, int));
-extern int check_bash_input PARAMS((int));
-extern int duplicate_buffered_stream PARAMS((int, int));
-extern BUFFERED_STREAM *fd_to_buffered_stream PARAMS((int));
-extern BUFFERED_STREAM *set_buffered_stream PARAMS((int, BUFFERED_STREAM *));
-extern BUFFERED_STREAM *open_buffered_stream PARAMS((char *));
-extern void free_buffered_stream PARAMS((BUFFERED_STREAM *));
-extern int close_buffered_stream PARAMS((BUFFERED_STREAM *));
-extern int close_buffered_fd PARAMS((int));
-extern int sync_buffered_stream PARAMS((int));
-extern int buffered_getchar PARAMS((void));
-extern int buffered_ungetchar PARAMS((int));
-extern void with_input_from_buffered_stream PARAMS((int, char *));
+extern int fd_is_bash_input (int);
+extern int set_bash_input_fd (int);
+extern int save_bash_input (int, int);
+extern int check_bash_input (int);
+extern int duplicate_buffered_stream (int, int);
+extern BUFFERED_STREAM *fd_to_buffered_stream (int);
+extern BUFFERED_STREAM *set_buffered_stream (int, BUFFERED_STREAM *);
+extern BUFFERED_STREAM *open_buffered_stream (char *);
+extern void free_buffered_stream (BUFFERED_STREAM *);
+extern int close_buffered_stream (BUFFERED_STREAM *);
+extern int close_buffered_fd (int);
+extern int sync_buffered_stream (int);
+extern int buffered_getchar (void);
+extern int buffered_ungetchar (int);
+extern void with_input_from_buffered_stream (int, char *);
#endif /* BUFFERED_INPUT */
#endif /* _INPUT_H_ */
/* System calls. */
#if !defined (HAVE_UNISTD_H)
-extern pid_t fork (), getpid (), getpgrp ();
+extern pid_t fork (void), getpid (void), getpgrp (void);
#endif /* !HAVE_UNISTD_H */
/* Stuff from the jobs.c file. */
extern JOB **jobs;
-extern void making_children PARAMS((void));
-extern void stop_making_children PARAMS((void));
-extern void cleanup_the_pipeline PARAMS((void));
-extern void discard_last_procsub_child PARAMS((void));
-extern void save_pipeline PARAMS((int));
-extern PROCESS *restore_pipeline PARAMS((int));
-extern void start_pipeline PARAMS((void));
-extern int stop_pipeline PARAMS((int, COMMAND *));
-extern int discard_pipeline PARAMS((PROCESS *));
-extern void append_process PARAMS((char *, pid_t, int, int));
-
-extern void save_proc_status PARAMS((pid_t, int));
-
-extern PROCESS *procsub_add PARAMS((PROCESS *));
-extern PROCESS *procsub_search PARAMS((pid_t));
-extern PROCESS *procsub_delete PARAMS((pid_t));
-extern int procsub_waitpid PARAMS((pid_t));
-extern void procsub_waitall PARAMS((void));
-extern void procsub_clear PARAMS((void));
-extern void procsub_prune PARAMS((void));
-
-extern void delete_job PARAMS((int, int));
-extern void nohup_job PARAMS((int));
-extern void delete_all_jobs PARAMS((int));
-extern void nohup_all_jobs PARAMS((int));
-
-extern int count_all_jobs PARAMS((void));
-
-extern void terminate_current_pipeline PARAMS((void));
-extern void terminate_stopped_jobs PARAMS((void));
-extern void hangup_all_jobs PARAMS((void));
-extern void kill_current_pipeline PARAMS((void));
+extern void making_children (void);
+extern void stop_making_children (void);
+extern void cleanup_the_pipeline (void);
+extern void discard_last_procsub_child (void);
+extern void save_pipeline (int);
+extern PROCESS *restore_pipeline (int);
+extern void start_pipeline (void);
+extern int stop_pipeline (int, COMMAND *);
+extern int discard_pipeline (PROCESS *);
+extern void append_process (char *, pid_t, int, int);
+
+extern void save_proc_status (pid_t, int);
+
+extern PROCESS *procsub_add (PROCESS *);
+extern PROCESS *procsub_search (pid_t);
+extern PROCESS *procsub_delete (pid_t);
+extern int procsub_waitpid (pid_t);
+extern void procsub_waitall (void);
+extern void procsub_clear (void);
+extern void procsub_prune (void);
+
+extern void delete_job (int, int);
+extern void nohup_job (int);
+extern void delete_all_jobs (int);
+extern void nohup_all_jobs (int);
+
+extern int count_all_jobs (void);
+
+extern void terminate_current_pipeline (void);
+extern void terminate_stopped_jobs (void);
+extern void hangup_all_jobs (void);
+extern void kill_current_pipeline (void);
#if defined (__STDC__) && defined (pid_t)
-extern int get_job_by_pid PARAMS((int, int, PROCESS **));
-extern void describe_pid PARAMS((int));
+extern int get_job_by_pid (int, int, PROCESS **);
+extern void describe_pid (int);
#else
-extern int get_job_by_pid PARAMS((pid_t, int, PROCESS **));
-extern void describe_pid PARAMS((pid_t));
+extern int get_job_by_pid (pid_t, int, PROCESS **);
+extern void describe_pid (pid_t);
#endif
-extern void list_one_job PARAMS((JOB *, int, int, int));
-extern void list_all_jobs PARAMS((int));
-extern void list_stopped_jobs PARAMS((int));
-extern void list_running_jobs PARAMS((int));
+extern void list_one_job (JOB *, int, int, int);
+extern void list_all_jobs (int);
+extern void list_stopped_jobs (int);
+extern void list_running_jobs (int);
-extern pid_t make_child PARAMS((char *, int));
+extern pid_t make_child (char *, int);
-extern int get_tty_state PARAMS((void));
-extern int set_tty_state PARAMS((void));
+extern int get_tty_state (void);
+extern int set_tty_state (void);
-extern int job_exit_status PARAMS((int));
-extern int job_exit_signal PARAMS((int));
+extern int job_exit_status (int);
+extern int job_exit_signal (int);
-extern int wait_for_single_pid PARAMS((pid_t, int));
-extern int wait_for_background_pids PARAMS((struct procstat *));
-extern int wait_for PARAMS((pid_t, int));
-extern int wait_for_job PARAMS((int, int, struct procstat *));
-extern int wait_for_any_job PARAMS((int, struct procstat *));
+extern int wait_for_single_pid (pid_t, int);
+extern int wait_for_background_pids (struct procstat *);
+extern int wait_for (pid_t, int);
+extern int wait_for_job (int, int, struct procstat *);
+extern int wait_for_any_job (int, struct procstat *);
-extern void wait_sigint_cleanup PARAMS((void));
+extern void wait_sigint_cleanup (void);
-extern void notify_and_cleanup PARAMS((void));
-extern void reap_dead_jobs PARAMS((void));
-extern int start_job PARAMS((int, int));
-extern int kill_pid PARAMS((pid_t, int, int));
-extern int initialize_job_control PARAMS((int));
-extern void initialize_job_signals PARAMS((void));
-extern int give_terminal_to PARAMS((pid_t, int));
+extern void notify_and_cleanup (void);
+extern void reap_dead_jobs (void);
+extern int start_job (int, int);
+extern int kill_pid (pid_t, int, int);
+extern int initialize_job_control (int);
+extern void initialize_job_signals (void);
+extern int give_terminal_to (pid_t, int);
-extern void run_sigchld_trap PARAMS((int));
+extern void run_sigchld_trap (int);
-extern int freeze_jobs_list PARAMS((void));
-extern void unfreeze_jobs_list PARAMS((void));
-extern void set_jobs_list_frozen PARAMS((int));
-extern int set_job_control PARAMS((int));
-extern void without_job_control PARAMS((void));
-extern void end_job_control PARAMS((void));
-extern void restart_job_control PARAMS((void));
-extern void set_sigchld_handler PARAMS((void));
-extern void ignore_tty_job_signals PARAMS((void));
-extern void default_tty_job_signals PARAMS((void));
-extern void get_original_tty_job_signals PARAMS((void));
+extern int freeze_jobs_list (void);
+extern void unfreeze_jobs_list (void);
+extern void set_jobs_list_frozen (int);
+extern int set_job_control (int);
+extern void without_job_control (void);
+extern void end_job_control (void);
+extern void restart_job_control (void);
+extern void set_sigchld_handler (void);
+extern void ignore_tty_job_signals (void);
+extern void default_tty_job_signals (void);
+extern void get_original_tty_job_signals (void);
-extern void init_job_stats PARAMS((void));
+extern void init_job_stats (void);
-extern void close_pgrp_pipe PARAMS((void));
-extern void save_pgrp_pipe PARAMS((int *, int));
-extern void restore_pgrp_pipe PARAMS((int *));
+extern void close_pgrp_pipe (void);
+extern void save_pgrp_pipe (int *, int);
+extern void restore_pgrp_pipe (int *);
-extern void set_maxchild PARAMS((int));
+extern void set_maxchild (int);
#ifdef DEBUG
extern void debug_print_pgrps (void);
/* 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.
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;
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
/* 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;
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;
/* 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;
#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;
}
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;
/* 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;
/* Remove backslashes quoting characters in PATHNAME by modifying PATHNAME. */
void
-udequote_pathname (pathname)
- char *pathname;
+udequote_pathname (char *pathname)
{
register int i, j;
#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;
}
static void
-wdequote_pathname (pathname)
- char *pathname;
+wdequote_pathname (char *pathname)
{
mbstate_t ps;
size_t len, n;
}
static void
-dequote_pathname (pathname)
- char *pathname;
+dequote_pathname (char *pathname)
{
if (MB_CUR_MAX > 1)
wdequote_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;
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;
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;
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;
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;
/* 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.
#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;
-/* 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.
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;
/* 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.
#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
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;
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;
/* 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? */
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 */
/* 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. */
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;
/* 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;
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 */
/* 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.
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 */
/* 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' };
}
static int
-rangecmp (c1, c2, forcecoll)
- int c1, c2;
- int forcecoll;
+rangecmp (int c1, int c2, int forcecoll)
{
int r;
#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;
#include "collsyms.h"
static int
-collsym (s, len)
- CHAR *s;
- int len;
+collsym (CHAR *s, int len)
{
register struct _collsym *csp;
char *x;
#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;
}
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;
}
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;
# 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 */
#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' };
}
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;
/* 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;
# include "collsyms.h"
static wint_t
-collwcsym (s, len)
- wchar_t *s;
- int len;
+collwcsym (wchar_t *s, int len)
{
register struct _collwcsym *csp;
}
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;
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 */
#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;
/* 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.
#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;
#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);
-/* 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.
/* 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 */
/* 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.
#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>.
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;
}
#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. */
}
#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.
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 */
/* 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.
#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.
/* 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.
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
# 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;
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
#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')
}
-char *
-internal_function
+inline char *
_nl_find_msg (domain_file, domainbinding, msgid, lengthp)
struct loaded_l10nfile *domain_file;
struct binding *domainbinding;
/* 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;
#ifndef _LIBC
/* Return string representation of locale CATEGORY. */
-static const char *
-internal_function
+static inline const char *
category_to_name (category)
int 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;
/* 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.
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;
/* 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.
/* 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;
/* 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.
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 @@ */
/* 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.
/* @@ 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)
/* 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.
# endif
#else
# ifndef HAVE_STPCPY
-static char *stpcpy PARAMS ((char *dest, const char *src));
+static char *stpcpy (char *dest, const char *src);
# endif
#endif
#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)
#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)
#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)
/* Return number of bits set in X. */
-static int pop PARAMS ((int x));
+static int pop (int x);
static inline int
pop (x)
/* 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.
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
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.
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 */
/* 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.
/* 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
/* 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;
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
}
/* Frees the codeset dependent parts of an opened message catalog. */
-void
-internal_function
+inline void
_nl_free_domain_conv (domain)
struct loaded_domain *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;
#ifdef _LIBC
-void
-internal_function
+inline void
_nl_unload_domain (domain)
struct loaded_domain *domain;
{
/* 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.
__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)
/* 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)
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;
}
-static size_t
-internal_function
+static inline size_t
read_alias_file (fname, fname_len)
const char *fname;
int 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;
}
/* 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.
#endif
-void
-internal_function
+inline void
EXTRACT_PLURAL_EXPRESSION (nullentry, pluralp, npluralsp)
const char *nullentry;
struct expression **pluralp;
/* 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.
#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
# define attribute_hidden
#endif
-
/* This is the representation of the expressions to determine the
plural form. */
struct expression
# 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 */
/* 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.
#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. */
#line 231 "/usr/src/local/bash/bash-20080814/lib/intl/plural.y"
-void
-internal_function
+inline void
FREE_EXPRESSION (exp)
struct expression *exp;
{
%{
/* 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.
%{
/* 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. */
%%
-void
-internal_function
+inline void
FREE_EXPRESSION (exp)
struct expression *exp;
{
#ifndef emacs
#define malloc xmalloc
-extern pointer xmalloc ();
+extern pointer xmalloc (size_t);
#endif
/* Define STACK_DIRECTION if you know the direction of stack
#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. */
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);
/* 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.
#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 */
/* 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.
#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
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);
/* 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);
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;
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;
/* 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;
}
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);
}
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);
#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;
/* 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;
}
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;
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;
}
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;
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;
#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;
}
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;
}
int
-posix_memalign (memptr, alignment, size)
- void **memptr;
- size_t alignment, size;
+posix_memalign (void **memptr, size_t alignment, size_t size)
{
void *mem;
}
size_t
-malloc_usable_size (mem)
- void *mem;
+malloc_usable_size (void *mem)
{
register union mhead *p;
register char *ap;
/* 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);
}
#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;
}
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);
}
#ifdef MALLOC_STATS
int
-malloc_free_blocks (size)
- int size;
+malloc_free_blocks (int size)
{
int nfree;
register union mhead *p;
#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);
}
#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);
}
/* 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);
}
#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);
}
/* 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.
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 */
/* 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.
#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
#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
/* 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.
#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;
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;
}
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;
}
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);
}
#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];
#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;
/* 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.
#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 */
* 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;
#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));
}
#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;
}
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;
}
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;
}
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;
/* 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";
}
static void
-_register_dump_table(fp)
- FILE *fp;
+_register_dump_table(FILE *fp)
{
register int i;
mr_table_t entry;
}
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));
/* 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;
}
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;
}
static void
-_location_dump_table (fp)
- FILE *fp;
+_location_dump_table (FILE *fp)
{
register ma_table_t *tp, *endp;
}
void
-mlocation_dump_table ()
+mlocation_dump_table (void)
{
_location_dump_table (stderr);
}
#define LOCROOT "/var/tmp/maltrace/locations."
void
-mlocation_write_table ()
+mlocation_write_table (void)
{
FILE *fp;
char defname[sizeof (LOCROOT) + 64];
}
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 */
#endif /* MALLOC_REGISTER */
int
-malloc_set_register(n)
- int n;
+malloc_set_register (int n)
{
int old;
/* 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.
#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;
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) */
/* 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.
#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;
}
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;
#endif /* MALLOC_TRACE */
int
-malloc_set_trace (n)
- int n;
+malloc_set_trace (int n)
{
int old;
}
void
-malloc_set_tracefp (fp)
- FILE *fp;
+malloc_set_tracefp (FILE *fp)
{
#ifdef MALLOC_TRACE
_mtrace_fp = fp ? fp : stderr;
}
void
-malloc_trace_bin (n)
- int n;
+malloc_trace_bin (int n)
{
#ifdef MALLOC_TRACE
_malloc_trace_buckets[n] = 1;
#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;
/* 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.
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;
}
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;
#endif /* MALLOC_WATCH */
PTR_T
-malloc_watch (addr)
- PTR_T addr;
+malloc_watch (PTR_T addr)
{
register int i;
PTR_T ret;
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;
/* 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.
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 */
/* 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.
/* **************************************************************** */
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);
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;
}
PTR_T
-xrealloc (pointer, bytes)
- PTR_T pointer;
- size_t bytes;
+xrealloc (PTR_T pointer, size_t bytes)
{
PTR_T temp;
}
void
-xfree (string)
- PTR_T string;
+xfree (PTR_T string)
{
if (string)
free (string);
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 */
/* 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.
#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)
#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;
/* 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;
/* 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.
#endif /* !HAVE_SYSCONF && !_SC_CLK_TCK */
long
-get_clk_tck ()
+get_clk_tck (void)
{
static long retval = 0;
/* 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.
#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>
#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;
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;
/* 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.
#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;
/* 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.
#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;
/* 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;
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;
/* 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;
#endif
int
-sh_eaccess (path, mode)
- const char *path;
- int mode;
+sh_eaccess (const char *path, int mode)
{
int ret;
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;
/* 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.
#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)
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)
}
static void
-init_tofs ()
+init_tofs (void)
{
char *cur;
}
static void
-init_fromfs ()
+init_fromfs (void)
{
char *cur;
}
char *
-fnx_tofs (string, len)
- char *string;
- size_t len;
+fnx_tofs (char *string, size_t len)
{
#ifdef MACOSX
ICONV_CONST char *inbuf;
}
char *
-fnx_fromfs (string, len)
- char *string;
- size_t len;
+fnx_fromfs (char *string, size_t len)
{
#ifdef MACOSX
ICONV_CONST char *inbuf;
#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;
}
/* 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.
#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>
/* 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.
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;
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[]
= "../../../../../../../../../../../../../../../../../../../../../../../\
static char *last_tempenv_value = (char *)NULL;
char *
-getenv (name)
- const char *name;
+getenv (const char *name)
{
SHELL_VAR *var;
/* 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;
#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;
#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? */
VUNSETATTR (v, att_exported);
#endif
- UNSETENV_RETURN(0);
+ return (0);
}
#endif /* CAN_REDEFINE_GETENV */
/* 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.
* 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;
* 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;
/* 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)
/* 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)
#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));
}
/* 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];
/* 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];
}
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));
}
/* 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];
/* 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.
*/
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;
/* 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.
# define MP_IGNDOT 0x08
#endif
-extern char *get_working_directory PARAMS((char *));
+extern char *get_working_directory (char *);
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;
/* 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;
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;
/* 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;
/* 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).
#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
{ 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)
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
+ (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
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;
#ifdef weak_alias
weak_alias (mktime, timelocal)
#endif
-\f
-#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 */
-\f
-/*
-Local Variables:
-compile-command: "gcc -DDEBUG=1 -Wall -O -g mktime.c -o mktime"
-End:
-*/
/* 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.
/* 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;
* 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.
#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;
/* 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;
* 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;
* 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;
* 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));
* host `host' on port `port' and return the connected socket.
*/
int
-netopen (path)
- char *path;
+netopen (char *path)
{
char *np, *s, *t;
int fd;
* `serv' and return the connected socket.
*/
int
-tcpopen (host, serv)
- char *host, *serv;
+tcpopen (char *host, char *serv)
{
return (_netopen (host, serv, 't'));
}
* `serv' and return the connected socket.
*/
int
-udpopen (host, serv)
- char *host, *serv;
+udpopen (char *host, char *serv)
{
return _netopen (host, serv, 'u');
}
#else /* !HAVE_NETWORK */
int
-netopen (path)
- char *path;
+netopen (char *path)
{
internal_error (_("network operations not supported"));
return -1;
/* 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.
/* 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;
}
char *
-strrchr (string, c)
- char *string;
- int c;
+strrchr (const char *string, int c)
{
register char *s, *t;
/* 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;
#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 */
# 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);
}
# undef bzero
# endif
void
-bzero (s, n)
- void *s;
- size_t n;
+bzero (void *s, size_t n)
{
register int i;
register char *r;
# 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;
}
# 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';
#if !defined (HAVE_KILLPG)
int
-killpg (pgrp, sig)
- pid_t pgrp;
- int sig;
+killpg (pid_t pgrp, int sig)
{
return (kill (-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));
#define DEFAULT_MAXGROUPS 64
int
-getmaxgroups ()
+getmaxgroups (void)
{
static int maxgroups = -1;
}
long
-getmaxchild ()
+getmaxchild (void)
{
static long maxchild = -1L;
/* 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.
#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];
/* 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;
#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;
/* 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.
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);
*/
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;
}
char *
-sh_realpath (pathname, resolved)
- const char *pathname;
- char *resolved;
+sh_realpath (const char *pathname, char *resolved)
{
char *tdir, *wd;
/* 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.
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",
}
static u_bits32_t
-genseed ()
+genseed (void)
{
struct timeval tv;
u_bits32_t iv;
/* Returns a pseudo-random number between 0 and 32767. */
int
-brand ()
+brand (void)
{
unsigned int ret;
/* 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;
/* Returns a 32-bit pseudo-random number between 0 and 4294967295. */
static u_bits32_t
-brand32 ()
+brand32 (void)
{
u_bits32_t ret;
}
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;
}
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);
#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;
#endif
u_bits32_t
-get_urandom32 ()
+get_urandom32 (void)
{
u_bits32_t ret;
* 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.
#endif
int
-rename (from, to)
- const char *from, *to;
+rename (const char *from, const char *to)
{
struct stat fb, tb;
/* 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);
#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;
-/* 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
/* 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 };
/* 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;
}
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;
/* 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.
#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] =
/* 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;
/* 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;
/* 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;
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;
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;
/* 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;
#endif /* PROMPT_STRING_DECODE */
char *
-sh_quote_reusable (s, flags)
- char *s;
- int flags;
+sh_quote_reusable (char *s, int flags)
{
char *ret;
}
int
-sh_contains_shell_metas (string)
- const char *string;
+sh_contains_shell_metas (const char *string)
{
const char *s;
}
int
-sh_contains_quotes (string)
- const char *string;
+sh_contains_quotes (const char *string)
{
const char *s;
* 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.
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);
}
int
-ttsetattr(fd, ttp)
-int fd;
-TTYSTRUCT *ttp;
+ttsetattr(int fd, TTYSTRUCT *ttp)
{
#ifdef TERMIOS_TTY_DRIVER
return tcsetattr(fd, TCSADRAIN, ttp);
}
void
-ttsave()
+ttsave(void)
{
if (ttsaved)
return;
}
void
-ttrestore()
+ttrestore(void)
{
if (ttsaved == 0)
return;
/* Retrieve the internally-saved attributes associated with tty fd FD. */
TTYSTRUCT *
-ttattr (fd)
- int fd;
+ttattr (int fd)
{
if (ttsaved == 0)
return ((TTYSTRUCT *)0);
* 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)
/* 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;
/* Set the terminal into one-character-at-a-time mode */
int
-ttonechar ()
+ttonechar (void)
{
TTYSTRUCT tt;
* 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);
/* 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;
/* Set the terminal into no-echo mode */
int
-ttnoecho ()
+ttnoecho (void)
{
TTYSTRUCT tt;
* 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;
/* 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;
/* Set the terminal into eight-bit mode */
int
-tteightbit ()
+tteightbit (void)
{
TTYSTRUCT tt;
* 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;
/* 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;
/* Set the terminal into non-canonical mode */
int
-ttnocanon ()
+ttnocanon (void)
{
TTYSTRUCT tt;
* 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;
/* 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;
/* Set the terminal into cbreak (no-echo, one-character-at-a-time) mode */
int
-ttcbreak ()
+ttcbreak (void)
{
TTYSTRUCT tt;
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.
# 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
/* 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
#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
* Find the nth power of 10
*/
static double
-pow_10(n)
- int n;
+pow_10(int n)
{
double P;
* 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.;
* 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;
* 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 */
* 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;
* 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;
#endif
static void
-pointer(p, d)
- struct DATA *p;
- unsigned long d;
+pointer(struct DATA *p, unsigned long d)
{
char *tmp;
/* %s strings */
static void
-strings(p, tmp)
- struct DATA *p;
- char *tmp;
+strings(struct DATA *p, char *tmp)
{
size_t len;
#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;
}
static void
-wchars (p, wc)
- struct DATA *p;
- wint_t wc;
+wchars (struct DATA *p, wint_t wc)
{
char *lbuf, *l;
mbstate_t mbs;
(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;
/* %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;
/* %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;
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;
/* 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;
}
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;
}
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
* 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;
#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];
#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;
}
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;
#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;
}
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;
#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;
}
static void *
-xrealloc (pointer, bytes)
- void *pointer;
- size_t bytes;
+xrealloc (void *pointer, size_t bytes)
{
void *ret;
}
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;
/* 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.
#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
* 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];
* 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;
* 3 otherwise
*/
static int
-spdist(cur, new)
- char *cur, *new;
+spdist(char *cur, char *new)
{
while (*cur == *new)
{
}
char *
-dirspell (dirname)
- char *dirname;
+dirspell (char *dirname)
{
int n;
char *guess;
/* 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.
/* 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;
/* 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;
/* 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.
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;
/* 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
/* 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;
/* 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.
/* Duplicate S, returning an identical malloc'd string. */
char *
-strdup (s)
- const char *s;
+strdup (const char *s)
{
size_t len;
void *new;
/* 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.
static char *errbase = "Unknown system error ";
char *
-strerror (e)
- int e;
+strerror (int e)
{
static char emsg[40];
#if defined (HAVE_SYS_ERRLIST)
/* 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.
/* Allocate a new STRINGLIST, with room for N strings. */
STRINGLIST *
-strlist_create (n)
- int n;
+strlist_create (int n)
{
STRINGLIST *ret;
register int i;
}
STRINGLIST *
-strlist_resize (sl, n)
- STRINGLIST *sl;
- int n;
+strlist_resize (STRINGLIST *sl, int n)
{
register int i;
}
void
-strlist_flush (sl)
- STRINGLIST *sl;
+strlist_flush (STRINGLIST *sl)
{
if (sl == 0 || sl->list == 0)
return;
}
void
-strlist_dispose (sl)
- STRINGLIST *sl;
+strlist_dispose (STRINGLIST *sl)
{
if (sl == 0)
return;
}
int
-strlist_remove (sl, s)
- STRINGLIST *sl;
- char *s;
+strlist_remove (STRINGLIST *sl, char *s)
{
int r;
}
STRINGLIST *
-strlist_copy (sl)
- STRINGLIST *sl;
+strlist_copy (STRINGLIST *sl)
{
STRINGLIST *new;
register int i;
/* 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;
/* 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;
}
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;
}
void
-strlist_print (sl, prefix)
- STRINGLIST *sl;
- char *prefix;
+strlist_print (STRINGLIST *sl, char *prefix)
{
register int i;
}
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;
}
void
-strlist_sort (sl)
- STRINGLIST *sl;
+strlist_sort (STRINGLIST *sl)
{
if (sl == 0 || sl->list_len == 0 || sl->list == 0)
return;
}
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;
}
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;
/* 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.
/* 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;
/* Free the contents of ARRAY, a NULL terminated array of char *. */
void
-strvec_flush (array)
- char **array;
+strvec_flush (char **array)
{
register int i;
}
void
-strvec_dispose (array)
- char **array;
+strvec_dispose (char **array)
{
if (array == 0)
return;
}
int
-strvec_remove (array, name)
- char **array, *name;
+strvec_remove (char **array, char *name)
{
register int i, j;
char *x;
/* 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;
/* 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;
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;
/* 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));
/* 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);
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;
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;
/* 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.
/* 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;
/* 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.
/* 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')
{
#endif
#include <sys/types.h>
-typedef unsigned chartype;
+typedef unsigned int chartype;
#undef strstr
/* 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.
#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;
/* 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.
"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
#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,
/* 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.
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;
/* 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.
"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
#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,
/* 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.
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;
/* 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;
#if defined (HANDLE_MULTIBYTE)
int
-ansic_wshouldquote (string)
- const char *string;
+ansic_wshouldquote (const char *string)
{
const wchar_t *wcs;
wchar_t wcc;
/* 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;
/* $'...' 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;
#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;
/* 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;
/* 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.
# 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;
/* 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.
#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;
}
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;
}
struct timeval *
-multimeval (d, m)
- struct timeval *d;
- int m;
+multimeval (struct timeval *d, int m)
{
time_t t;
}
struct timeval *
-divtimeval (d, m)
- struct timeval *d;
- int m;
+divtimeval (struct timeval *d, int m)
{
time_t t;
/* 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;
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;
/* 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;
* 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.
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;
static unsigned long filenum = 1L;
static char *
-get_sys_tmpdir ()
+get_sys_tmpdir (void)
{
if (sys_tmpdir)
return sys_tmpdir;
}
static char *
-get_tmpdir (flags)
- int flags;
+get_tmpdir (int flags)
{
char *tdir;
}
static void
-sh_seedrand ()
+sh_seedrand (void)
{
#if HAVE_RANDOM
int d;
}
char *
-sh_mktmpname (nameroot, flags)
- char *nameroot;
- int flags;
+sh_mktmpname (char *nameroot, int flags)
{
char *filename, *tdir, *lroot;
struct stat sb;
}
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;
}
FILE *
-sh_mktmpfp (nameroot, flags, namep)
- char *nameroot;
- int flags;
- char **namep;
+sh_mktmpfp (char *nameroot, int flags, char **namep)
{
int fd;
FILE *fp;
}
char *
-sh_mktmpdir (nameroot, flags)
- char *nameroot;
- int flags;
+sh_mktmpdir (char *nameroot, int flags)
{
char *filename, *tdir, *lroot, *dirname;
int fd, tdlen;
/* 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.
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;
#if defined (HAVE_SETITIMER)
unsigned int
-falarm(secs, usecs)
- unsigned int secs, usecs;
+falarm(unsigned int secs, unsigned int usecs)
{
struct itimerval it, oit;
}
#else
int
-falarm (secs, usecs)
- unsigned int secs, usecs;
+falarm (unsigned int secs, unsigned int usecs)
{
if (secs == 0 && usecs == 0)
return (alarm (0));
#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;
}
#else /* !HAVE_TIMEVAL || !HAVE_SELECT */
int
-fsleep(sec, usec)
- long sec, usec;
+fsleep(unsigned int sec, unsigned int usec)
{
if (usec >= 500000) /* round */
sec++;
/* 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.
#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;
static char charsetbuf[40];
static char *
-stub_charset ()
+stub_charset (void)
{
char *locale, *s, *t;
#endif
void
-u32reset ()
+u32reset (void)
{
#if defined (HAVE_ICONV)
if (u32init && localconv != (iconv_t)-1)
/* u32toascii ? */
int
-u32tochar (x, s)
- unsigned long x;
- char *s;
+u32tochar (unsigned long x, char *s)
{
int l;
}
int
-u32tocesc (wc, s)
- u_bits32_t wc;
- char *s;
+u32tocesc (u_bits32_t wc, char *s)
{
int l;
/* 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;
/* 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;
/* 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];
}
#else
void
-u32reset ()
+u32reset (void)
{
}
#endif /* HANDLE_MULTIBYTE */
/* 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.
#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;
}
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;
/* 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;
/* 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;
#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];
* 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;
/* 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.
#include <xmalloc.h>
wchar_t *
-wcsdup (ws)
- const wchar_t *ws;
+wcsdup (const wchar_t *ws)
{
wchar_t *ret;
size_t len;
/* 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.
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;
/* 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.
#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;
/* 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.
/* 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 */
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;
/* 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.
# 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;
/* 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.
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
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;
/* 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.
# 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;
/* 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.
/* 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;
#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;
/* 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));
static size_t lind, lused;
ssize_t
-zreadc (fd, cp)
- int fd;
- char *cp;
+zreadc (int fd, char *cp)
{
ssize_t nr;
/* 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;
/* 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;
}
void
-zreset ()
+zreset (void)
{
lind = lused = 0;
}
/* 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;
/* 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.
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;
/* list.c - Functions for manipulating linked lists of objects. */
-/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2009,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#ifdef INCLUDE_UNUSED
/* Call FUNCTION on every member of LIST, a generic list. */
void
-list_walk (list, function)
- GENERIC_LIST *list;
- sh_glist_func_t *function;
+list_walk (GENERIC_LIST *list, sh_glist_func_t *function)
{
for ( ; list; list = list->next)
if ((*function) (list) < 0)
/* Call FUNCTION on every string in WORDS. */
void
-wlist_walk (words, function)
- WORD_LIST *words;
- sh_icpfunc_t *function;
+wlist_walk (WORD_LIST *words, sh_icpfunc_t *function)
{
for ( ; words; words = words->next)
if ((*function) (words->word->word) < 0)
of the chain. You should always assign the output value of this
function to something, or you will lose the chain. */
GENERIC_LIST *
-list_reverse (list)
- GENERIC_LIST *list;
+list_reverse (GENERIC_LIST *list)
{
register GENERIC_LIST *next, *prev;
/* Return the number of elements in LIST, a generic list. */
int
-list_length (list)
- GENERIC_LIST *list;
+list_length (GENERIC_LIST *list)
{
register int i;
/* Append TAIL to HEAD. Return the header of the list. */
GENERIC_LIST *
-list_append (head, tail)
- GENERIC_LIST *head, *tail;
+list_append (GENERIC_LIST *head, GENERIC_LIST *tail)
{
register GENERIC_LIST *t_head;
dispose_variable (elt);
*/
GENERIC_LIST *
-list_remove (list, comparer, arg)
- GENERIC_LIST **list;
- Function *comparer;
- char *arg;
+list_remove (GENERIC_LIST **list, sh_gcp_func_t *comparer, char *arg)
{
register GENERIC_LIST *prev, *temp;
/* mailcheck.h -- variables and function declarations for mail checking. */
-/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define _MAILCHECK_H_
/* Functions from mailcheck.c */
-extern int time_to_check_mail PARAMS((void));
-extern void reset_mail_timer PARAMS((void));
-extern void reset_mail_files PARAMS((void));
-extern void free_mail_files PARAMS((void));
-extern char *make_default_mailpath PARAMS((void));
-extern void remember_mail_dates PARAMS((void));
-extern void init_mail_dates PARAMS((void));
-extern void check_mail PARAMS((void));
+extern int time_to_check_mail (void);
+extern void reset_mail_timer (void);
+extern void reset_mail_files (void);
+extern void free_mail_files (void);
+extern char *make_default_mailpath (void);
+extern void remember_mail_dates (void);
+extern void init_mail_dates (void);
+extern void check_mail (void);
#endif /* _MAILCHECK_H */
/* make_cmd.h -- Declarations of functions found in make_cmd.c */
-/* Copyright (C) 1993-2009,2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2009,2020-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int here_doc_first_line;
-extern void cmd_init PARAMS((void));
+extern void cmd_init (void);
-extern WORD_DESC *alloc_word_desc PARAMS((void));
-extern WORD_DESC *make_bare_word PARAMS((const char *));
-extern WORD_DESC *make_word_flags PARAMS((WORD_DESC *, const char *));
-extern WORD_DESC *make_word PARAMS((const char *));
-extern WORD_DESC *make_word_from_token PARAMS((int));
+extern WORD_DESC *alloc_word_desc (void);
+extern WORD_DESC *make_bare_word (const char *);
+extern WORD_DESC *make_word_flags (WORD_DESC *, const char *);
+extern WORD_DESC *make_word (const char *);
+extern WORD_DESC *make_word_from_token (int);
-extern WORD_LIST *make_word_list PARAMS((WORD_DESC *, WORD_LIST *));
+extern WORD_LIST *make_word_list (WORD_DESC *, WORD_LIST *);
#define add_string_to_list(s, l) make_word_list (make_word(s), (l))
-extern COMMAND *make_command PARAMS((enum command_type, SIMPLE_COM *));
-extern COMMAND *command_connect PARAMS((COMMAND *, COMMAND *, int));
-extern COMMAND *make_for_command PARAMS((WORD_DESC *, WORD_LIST *, COMMAND *, int));
-extern COMMAND *make_group_command PARAMS((COMMAND *));
-extern COMMAND *make_case_command PARAMS((WORD_DESC *, PATTERN_LIST *, int));
-extern PATTERN_LIST *make_pattern_list PARAMS((WORD_LIST *, COMMAND *));
-extern COMMAND *make_if_command PARAMS((COMMAND *, COMMAND *, COMMAND *));
-extern COMMAND *make_while_command PARAMS((COMMAND *, COMMAND *));
-extern COMMAND *make_until_command PARAMS((COMMAND *, COMMAND *));
-extern COMMAND *make_bare_simple_command PARAMS((void));
-extern COMMAND *make_simple_command PARAMS((ELEMENT, COMMAND *));
-extern void make_here_document PARAMS((REDIRECT *, int));
-extern REDIRECT *make_redirection PARAMS((REDIRECTEE, enum r_instruction, REDIRECTEE, int));
-extern COMMAND *make_function_def PARAMS((WORD_DESC *, COMMAND *, int, int));
-extern COMMAND *clean_simple_command PARAMS((COMMAND *));
-
-extern COMMAND *make_arith_command PARAMS((WORD_LIST *));
-
-extern COMMAND *make_select_command PARAMS((WORD_DESC *, WORD_LIST *, COMMAND *, int));
+extern COMMAND *make_command (enum command_type, SIMPLE_COM *);
+extern COMMAND *command_connect (COMMAND *, COMMAND *, int);
+extern COMMAND *make_for_command (WORD_DESC *, WORD_LIST *, COMMAND *, int);
+extern COMMAND *make_group_command (COMMAND *);
+extern COMMAND *make_case_command (WORD_DESC *, PATTERN_LIST *, int);
+extern PATTERN_LIST *make_pattern_list (WORD_LIST *, COMMAND *);
+extern COMMAND *make_if_command (COMMAND *, COMMAND *, COMMAND *);
+extern COMMAND *make_while_command (COMMAND *, COMMAND *);
+extern COMMAND *make_until_command (COMMAND *, COMMAND *);
+extern COMMAND *make_bare_simple_command (void);
+extern COMMAND *make_simple_command (ELEMENT, COMMAND *);
+extern void make_here_document (REDIRECT *, int);
+extern REDIRECT *make_redirection (REDIRECTEE, enum r_instruction, REDIRECTEE, int);
+extern COMMAND *make_function_def (WORD_DESC *, COMMAND *, int, int);
+extern COMMAND *clean_simple_command (COMMAND *);
+
+extern COMMAND *make_arith_command (WORD_LIST *);
+
+extern COMMAND *make_select_command (WORD_DESC *, WORD_LIST *, COMMAND *, int);
#if defined (COND_COMMAND)
-extern COND_COM *make_cond_node PARAMS((int, WORD_DESC *, COND_COM *, COND_COM *));
-extern COMMAND *make_cond_command PARAMS((COND_COM *));
+extern COND_COM *make_cond_node (int, WORD_DESC *, COND_COM *, COND_COM *);
+extern COMMAND *make_cond_command (COND_COM *);
#endif
-extern COMMAND *make_arith_for_command PARAMS((WORD_LIST *, COMMAND *, int));
+extern COMMAND *make_arith_for_command (WORD_LIST *, COMMAND *, int);
-extern COMMAND *make_subshell_command PARAMS((COMMAND *));
-extern COMMAND *make_coproc_command PARAMS((char *, COMMAND *));
+extern COMMAND *make_subshell_command (COMMAND *);
+extern COMMAND *make_coproc_command (char *, COMMAND *);
-extern COMMAND *connect_async_list PARAMS((COMMAND *, COMMAND *, int));
+extern COMMAND *connect_async_list (COMMAND *, COMMAND *, int);
#endif /* !_MAKE_CMD_H */
* mksyntax.c - construct shell syntax table for fast char attribute lookup.
*/
-/* Copyright (C) 2000-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2009,2012,2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#include \"syntax.h\"\n\n";
static void
-usage()
+usage(void)
{
fprintf (stderr, "%s: usage: %s [-d] [-o filename]\n", progname, progname);
exit (2);
#ifdef INCLUDE_UNUSED
static int
-getcflag (s)
- char *s;
+getcflag (char *s)
{
int i;
#endif
static char *
-cdesc (i)
- int i;
+cdesc (int i)
{
static char xbuf[16];
}
static char *
-getcstr (f)
- int f;
+getcstr (int f)
{
int i;
}
static void
-addcstr (str, flag)
- char *str;
- int flag;
+addcstr (char *str, int flag)
{
char *s, *fstr;
unsigned char uc;
}
static void
-addcchar (c, flag)
- unsigned char c;
- int flag;
+addcchar (unsigned char c, int flag)
{
char *fstr;
}
static void
-addblanks ()
+addblanks (void)
{
register int i;
unsigned char uc;
/* load up the correct flag values in lsyntax */
static void
-load_lsyntax ()
+load_lsyntax (void)
{
/* shell metacharacters */
addcstr (shell_meta_chars, CSHMETA);
}
static void
-dump_lflags (fp, ind)
- FILE *fp;
- int ind;
+dump_lflags (FILE *fp, int ind)
{
int xflags, first, i;
}
static void
-wcomment (fp, i)
- FILE *fp;
- int i;
+wcomment (FILE *fp, int i)
{
fputs ("\t\t/* ", fp);
}
static void
-dump_lsyntax (fp)
- FILE *fp;
+dump_lsyntax (FILE *fp)
{
int i;
}
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
int opt, i;
char *filename;
#endif
char *
-strerror (e)
- int e;
+strerror (int e)
{
static char emsg[40];
#if defined (HAVE_SYS_ERRLIST)
/* pathexp.h -- The shell interface to the globbing library. */
-/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int glob_star;
extern int match_ignore_case; /* doesn't really belong here */
-extern int unquoted_glob_pattern_p PARAMS((char *));
+extern int unquoted_glob_pattern_p (char *);
/* PATHNAME can contain characters prefixed by CTLESC; this indicates
that the character is to be quoted. We quote it here in the style
pattern while executing a case statement), flags should include
QGLOB_CVTNULL. If flags includes QGLOB_FILENAME, appropriate quoting
to match a filename should be performed. */
-extern char *quote_string_for_globbing PARAMS((const char *, int));
+extern char *quote_string_for_globbing (const char *, int);
-extern int glob_char_p PARAMS((const char *));
-extern char *quote_globbing_chars PARAMS((const char *));
+extern int glob_char_p (const char *);
+extern char *quote_globbing_chars (const char *);
/* Call the glob library to do globbing on PATHNAME. FLAGS is additional
flags to pass to QUOTE_STRING_FOR_GLOBBING, mostly having to do with
whether or not we've already performed quote removal. */
-extern char **shell_glob_filename PARAMS((const char *, int));
+extern char **shell_glob_filename (const char *, int);
/* Filename completion ignore. Used to implement the "fignore" facility of
tcsh, GLOBIGNORE (like ksh-93 FIGNORE), and EXECIGNORE.
int len, flags;
};
-typedef int sh_iv_item_func_t PARAMS((struct ign *));
+typedef int sh_iv_item_func_t (struct ign *);
struct ignorevar {
char *varname; /* FIGNORE, GLOBIGNORE, or EXECIGNORE */
sh_iv_item_func_t *item_func; /* Called when each item is parsed from $`varname' */
};
-extern void setup_ignore_patterns PARAMS((struct ignorevar *));
+extern void setup_ignore_patterns (struct ignorevar *);
-extern void setup_glob_ignore PARAMS((char *));
-extern int should_ignore_glob_matches PARAMS((void));
-extern void ignore_glob_matches PARAMS((char **));
+extern void setup_glob_ignore (char *);
+extern int should_ignore_glob_matches (void);
+extern void ignore_glob_matches (char **);
#endif
/* pcomplete.h - structure definitions and other stuff for programmable
completion. */
-/* 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.
completions. */
typedef struct _list_of_items {
int flags;
- int (*list_getter) PARAMS((struct _list_of_items *)); /* function to call to get the list */
+ int (*list_getter) (struct _list_of_items *); /* function to call to get the list */
STRINGLIST *slist;
extern const char *pcomp_curcmd;
/* Functions from pcomplib.c */
-extern COMPSPEC *compspec_create PARAMS((void));
-extern void compspec_dispose PARAMS((COMPSPEC *));
-extern COMPSPEC *compspec_copy PARAMS((COMPSPEC *));
+extern COMPSPEC *compspec_create (void);
+extern void compspec_dispose (COMPSPEC *);
+extern COMPSPEC *compspec_copy (COMPSPEC *);
-extern void progcomp_create PARAMS((void));
-extern void progcomp_flush PARAMS((void));
-extern void progcomp_dispose PARAMS((void));
+extern void progcomp_create (void);
+extern void progcomp_flush (void);
+extern void progcomp_dispose (void);
-extern int progcomp_size PARAMS((void));
+extern int progcomp_size (void);
-extern int progcomp_insert PARAMS((char *, COMPSPEC *));
-extern int progcomp_remove PARAMS((char *));
+extern int progcomp_insert (char *, COMPSPEC *);
+extern int progcomp_remove (char *);
-extern COMPSPEC *progcomp_search PARAMS((const char *));
+extern COMPSPEC *progcomp_search (const char *);
-extern void progcomp_walk PARAMS((hash_wfunc *));
+extern void progcomp_walk (hash_wfunc *);
/* Functions from pcomplete.c */
-extern void set_itemlist_dirty PARAMS((ITEMLIST *));
+extern void set_itemlist_dirty (ITEMLIST *);
-extern STRINGLIST *completions_to_stringlist PARAMS((char **));
+extern STRINGLIST *completions_to_stringlist (char **);
-extern STRINGLIST *gen_compspec_completions PARAMS((COMPSPEC *, const char *, const char *, int, int, int *));
-extern char **programmable_completions PARAMS((const char *, const char *, int, int, int *));
+extern STRINGLIST *gen_compspec_completions (COMPSPEC *, const char *, const char *, int, int, int *);
+extern char **programmable_completions (const char *, const char *, int, int, int *);
-extern void pcomp_set_readline_variables PARAMS((int, int));
-extern void pcomp_set_compspec_options PARAMS((COMPSPEC *, int, int));
+extern void pcomp_set_readline_variables (int, int);
+extern void pcomp_set_compspec_options (COMPSPEC *, int, int);
#endif /* _PCOMPLETE_H_ */
/* redir.h - functions from redir.c. */
-/* Copyright (C) 1997, 2001, 2005, 2008, 2009-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2005, 2008, 2009-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define RX_SAVCLEXEC 0x20 /* set close-on-exec off in restored fd even though saved on has it on */
#define RX_SAVEFD 0x40 /* fd used to save another even if < SHELL_FD_BASE */
-extern void redirection_error PARAMS((REDIRECT *, int, char *));
-extern int do_redirections PARAMS((REDIRECT *, int));
-extern char *redirection_expand PARAMS((WORD_DESC *));
-extern int stdin_redirects PARAMS((REDIRECT *));
+extern void redirection_error (REDIRECT *, int, char *);
+extern int do_redirections (REDIRECT *, int);
+extern char *redirection_expand (WORD_DESC *);
+extern int stdin_redirects (REDIRECT *);
/* in builtins/evalstring.c for now, could move later */
-extern int open_redir_file PARAMS((REDIRECT *, char **));
+extern int open_redir_file (REDIRECT *, char **);
#endif /* _REDIR_H_ */
/* shell.h -- The data structures used by the shell */
-/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
} sh_input_line_state_t;
/* Let's try declaring these here. */
-extern void shell_ungets PARAMS((char *));
-extern void rewind_input_string PARAMS((void));
+extern void shell_ungets (char *);
+extern void rewind_input_string (void);
-extern char *parser_remaining_input PARAMS((void));
+extern char *parser_remaining_input (void);
-extern sh_parser_state_t *save_parser_state PARAMS((sh_parser_state_t *));
-extern void restore_parser_state PARAMS((sh_parser_state_t *));
+extern sh_parser_state_t *save_parser_state (sh_parser_state_t *);
+extern void restore_parser_state (sh_parser_state_t *);
-extern sh_input_line_state_t *save_input_line_state PARAMS((sh_input_line_state_t *));
-extern void restore_input_line_state PARAMS((sh_input_line_state_t *));
+extern sh_input_line_state_t *save_input_line_state (sh_input_line_state_t *);
+extern void restore_input_line_state (sh_input_line_state_t *);
/* sig.h -- header file for signal handler definitions. */
-/* Copyright (C) 1994-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#endif
#define sighandler void
-typedef void SigHandler PARAMS((int));
+typedef void SigHandler (int);
#define SIGRETURN(n) return
#if !defined (HAVE_POSIX_SIGNALS)
# define set_signal_handler(sig, handler) (SigHandler *)signal (sig, handler)
#else
-extern SigHandler *set_signal_handler PARAMS((int, SigHandler *)); /* in sig.c */
+extern SigHandler *set_signal_handler (int, SigHandler *); /* in sig.c */
#endif /* _POSIX_VERSION */
#if !defined (SIGCHLD) && defined (SIGCLD)
extern int terminate_immediately;
/* Functions from sig.c. */
-extern sighandler termsig_sighandler PARAMS((int));
-extern void termsig_handler PARAMS((int));
-extern sighandler sigint_sighandler PARAMS((int));
-extern void initialize_signals PARAMS((int));
-extern void initialize_terminating_signals PARAMS((void));
-extern void reset_terminating_signals PARAMS((void));
-extern void top_level_cleanup PARAMS((void));
-extern void throw_to_top_level PARAMS((void));
-extern void jump_to_top_level PARAMS((int)) __attribute__((__noreturn__));
-extern void restore_sigmask PARAMS((void));
-
-extern sighandler sigwinch_sighandler PARAMS((int));
-extern void set_sigwinch_handler PARAMS((void));
-extern void unset_sigwinch_handler PARAMS((void));
-
-extern sighandler sigterm_sighandler PARAMS((int));
+extern sighandler termsig_sighandler (int);
+extern void termsig_handler (int);
+extern sighandler sigint_sighandler (int);
+extern void initialize_signals (int);
+extern void initialize_terminating_signals (void);
+extern void reset_terminating_signals (void);
+extern void top_level_cleanup (void);
+extern void throw_to_top_level (void);
+extern void jump_to_top_level (int) __attribute__((__noreturn__));
+extern void restore_sigmask (void);
+
+extern sighandler sigwinch_sighandler (int);
+extern void set_sigwinch_handler (void);
+extern void unset_sigwinch_handler (void);
+
+extern sighandler sigterm_sighandler (int);
/* Functions defined in trap.c. */
-extern SigHandler *set_sigint_handler PARAMS((void));
-extern SigHandler *trap_to_sighandler PARAMS((int));
-extern sighandler trap_handler PARAMS((int));
+extern SigHandler *set_sigint_handler (void);
+extern SigHandler *trap_to_sighandler (int);
+extern sighandler trap_handler (int);
-extern int block_trapped_signals PARAMS((sigset_t *, sigset_t *));
-extern int unblock_trapped_signals PARAMS((sigset_t *));
+extern int block_trapped_signals (sigset_t *, sigset_t *);
+extern int unblock_trapped_signals (sigset_t *);
#endif /* _SIG_H_ */
/* siglist.h -- encapsulate various definitions for sys_siglist */
-/* Copyright (C) 1993, 2001, 2005, 2008-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 2001, 2005, 2008-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#endif /* !strsignal && !HAVE_STRSIGNAL */
#if !defined (strsignal) && !HAVE_DECL_STRSIGNAL
-extern char *strsignal PARAMS((int));
+extern char *strsignal (int);
#endif
#endif /* _SIGLIST_H */
/* subst.h -- Names of externally visible functions in subst.c. */
-/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
/* Remove backslashes which are quoting backquotes from STRING. Modifies
STRING, and returns a pointer to it. */
-extern char * de_backslash PARAMS((char *, int));
+extern char * de_backslash (char *, int);
/* Replace instances of \! in a string with !. */
-extern void unquote_bang PARAMS((char *));
+extern void unquote_bang (char *);
/* Extract the $( construct in STRING, and return a new string.
Start extracting at (SINDEX) as if we had just seen "$(".
Make (SINDEX) get the position just after the matching ")".
XFLAGS is additional flags to pass to other extraction functions, */
-extern char *extract_command_subst PARAMS((char *, int *, int));
+extern char *extract_command_subst (char *, int *, int);
/* Extract the $[ construct in STRING, and return a new string.
Start extracting at (SINDEX) as if we had just seen "$[".
Make (SINDEX) get the position just after the matching "]". */
-extern char *extract_arithmetic_subst PARAMS((char *, int *));
+extern char *extract_arithmetic_subst (char *, int *);
#if defined (PROCESS_SUBSTITUTION)
/* Extract the <( or >( construct in STRING, and return a new string.
Start extracting at (SINDEX) as if we had just seen "<(".
Make (SINDEX) get the position just after the matching ")". */
-extern char *extract_process_subst PARAMS((char *, char *, int *, int));
+extern char *extract_process_subst (char *, char *, int *, int);
#endif /* PROCESS_SUBSTITUTION */
/* Extract the name of the variable to bind to from the assignment string. */
-extern char *assignment_name PARAMS((char *));
+extern char *assignment_name (char *);
/* Return a single string of all the words present in LIST, separating
each word with SEP. */
-extern char *string_list_internal PARAMS((WORD_LIST *, char *));
+extern char *string_list_internal (WORD_LIST *, char *);
/* Return a single string of all the words present in LIST, separating
each word with a space. */
-extern char *string_list PARAMS((WORD_LIST *));
+extern char *string_list (WORD_LIST *);
/* Turn $* into a single string, obeying POSIX rules. */
-extern char *string_list_dollar_star PARAMS((WORD_LIST *, int, int));
+extern char *string_list_dollar_star (WORD_LIST *, int, int);
/* Expand $@ into a single string, obeying POSIX rules. */
-extern char *string_list_dollar_at PARAMS((WORD_LIST *, int, int));
+extern char *string_list_dollar_at (WORD_LIST *, int, int);
/* Turn the positional parameters into a string, understanding quoting and
the various subtleties of using the first character of $IFS as the
separator. Calls string_list_dollar_at, string_list_dollar_star, and
string_list as appropriate. */
-extern char *string_list_pos_params PARAMS((int, WORD_LIST *, int, int));
+extern char *string_list_pos_params (int, WORD_LIST *, int, int);
/* Perform quoted null character removal on each element of LIST.
This modifies LIST. */
-extern void word_list_remove_quoted_nulls PARAMS((WORD_LIST *));
+extern void word_list_remove_quoted_nulls (WORD_LIST *);
/* This performs word splitting and quoted null character removal on
STRING. */
-extern WORD_LIST *list_string PARAMS((char *, char *, int));
+extern WORD_LIST *list_string (char *, char *, int);
-extern char *ifs_firstchar PARAMS((int *));
-extern char *get_word_from_string PARAMS((char **, char *, char **));
-extern char *strip_trailing_ifs_whitespace PARAMS((char *, char *, int));
+extern char *ifs_firstchar (int *);
+extern char *get_word_from_string (char **, char *, char **);
+extern char *strip_trailing_ifs_whitespace (char *, char *, int);
/* Given STRING, an assignment string, get the value of the right side
of the `=', and bind it to the left side. If EXPAND is true, then
perform tilde expansion, parameter expansion, command substitution,
and arithmetic expansion on the right-hand side. Do not perform word
splitting on the result of expansion. */
-extern int do_assignment PARAMS((char *));
-extern int do_assignment_no_expand PARAMS((char *));
-extern int do_word_assignment PARAMS((WORD_DESC *, int));
+extern int do_assignment (char *);
+extern int do_assignment_no_expand (char *);
+extern int do_word_assignment (WORD_DESC *, int);
/* Append SOURCE to TARGET at INDEX. SIZE is the current amount
of space allocated to TARGET. SOURCE can be NULL, in which
case nothing happens. Gets rid of SOURCE by free ()ing it.
Returns TARGET in case the location has changed. */
-extern char *sub_append_string PARAMS((char *, char *, size_t *, size_t *));
+extern char *sub_append_string (char *, char *, size_t *, size_t *);
/* Append the textual representation of NUMBER to TARGET.
INDEX and SIZE are as in SUB_APPEND_STRING. */
-extern char *sub_append_number PARAMS((intmax_t, char *, int *, int *));
+extern char *sub_append_number (intmax_t, char *, int *, int *);
/* Return the word list that corresponds to `$*'. */
-extern WORD_LIST *list_rest_of_args PARAMS((void));
+extern WORD_LIST *list_rest_of_args (void);
/* Make a single large string out of the dollar digit variables,
and the rest_of_args. If DOLLAR_STAR is 1, then obey the special
case of "$*" with respect to IFS. */
-extern char *string_rest_of_args PARAMS((int));
+extern char *string_rest_of_args (int);
/* Expand STRING by performing parameter expansion, command substitution,
and arithmetic expansion. Dequote the resulting WORD_LIST before
returning it, but do not perform word splitting. The call to
remove_quoted_nulls () is made here because word splitting normally
takes care of quote removal. */
-extern WORD_LIST *expand_string_unsplit PARAMS((char *, int));
+extern WORD_LIST *expand_string_unsplit (char *, int);
/* Expand the rhs of an assignment statement. */
-extern WORD_LIST *expand_string_assignment PARAMS((char *, int));
+extern WORD_LIST *expand_string_assignment (char *, int);
/* Expand a prompt string. */
-extern WORD_LIST *expand_prompt_string PARAMS((char *, int, int));
+extern WORD_LIST *expand_prompt_string (char *, int, int);
/* Expand STRING just as if you were expanding a word. This also returns
a list of words. Note that filename globbing is *NOT* done for word
or string expansion, just when the shell is expanding a command. This
does parameter expansion, command substitution, arithmetic expansion,
and word splitting. Dequote the resultant WORD_LIST before returning. */
-extern WORD_LIST *expand_string PARAMS((char *, int));
+extern WORD_LIST *expand_string (char *, int);
/* Convenience functions that expand strings to strings, taking care of
converting the WORD_LIST * returned by the expand_string* functions
to a string and deallocating the WORD_LIST *. */
-extern char *expand_string_to_string PARAMS((char *, int));
-extern char *expand_string_unsplit_to_string PARAMS((char *, int));
-extern char *expand_assignment_string_to_string PARAMS((char *, int));
-extern char *expand_subscript_string PARAMS((char *, int));
+extern char *expand_string_to_string (char *, int);
+extern char *expand_string_unsplit_to_string (char *, int);
+extern char *expand_assignment_string_to_string (char *, int);
+extern char *expand_subscript_string (char *, int);
/* Expand an arithmetic expression string */
-extern char *expand_arith_string PARAMS((char *, int));
+extern char *expand_arith_string (char *, int);
/* Expand $'...' and $"..." in a string for code paths that do not. */
-extern char *expand_string_dollar_quote PARAMS((char *, int));
+extern char *expand_string_dollar_quote (char *, int);
/* De-quote quoted characters in STRING. */
-extern char *dequote_string PARAMS((char *));
+extern char *dequote_string (char *);
/* De-quote CTLESC-escaped CTLESC or CTLNUL characters in STRING. */
-extern char *dequote_escapes PARAMS((const char *));
+extern char *dequote_escapes (const char *);
-extern WORD_DESC *dequote_word PARAMS((WORD_DESC *));
+extern WORD_DESC *dequote_word (WORD_DESC *);
/* De-quote quoted characters in each word in LIST. */
-extern WORD_LIST *dequote_list PARAMS((WORD_LIST *));
+extern WORD_LIST *dequote_list (WORD_LIST *);
/* Expand WORD, performing word splitting on the result. This does
parameter expansion, command substitution, arithmetic expansion,
word splitting, and quote removal. */
-extern WORD_LIST *expand_word PARAMS((WORD_DESC *, int));
+extern WORD_LIST *expand_word (WORD_DESC *, int);
/* Expand WORD, but do not perform word splitting on the result. This
does parameter expansion, command substitution, arithmetic expansion,
and quote removal. */
-extern WORD_LIST *expand_word_unsplit PARAMS((WORD_DESC *, int));
-extern WORD_LIST *expand_word_leave_quoted PARAMS((WORD_DESC *, int));
+extern WORD_LIST *expand_word_unsplit (WORD_DESC *, int);
+extern WORD_LIST *expand_word_leave_quoted (WORD_DESC *, int);
/* Return the value of a positional parameter. This handles values > 10. */
-extern char *get_dollar_var_value PARAMS((intmax_t));
+extern char *get_dollar_var_value (intmax_t);
/* Quote a string to protect it from word splitting. */
-extern char *quote_string PARAMS((char *));
+extern char *quote_string (char *);
/* Quote escape characters (characters special to internals of expansion)
in a string. */
-extern char *quote_escapes PARAMS((const char *));
+extern char *quote_escapes (const char *);
/* And remove such quoted special characters. */
-extern char *remove_quoted_escapes PARAMS((char *));
+extern char *remove_quoted_escapes (char *);
/* Remove CTLNUL characters from STRING unless they are quoted with CTLESC. */
-extern char *remove_quoted_nulls PARAMS((char *));
+extern char *remove_quoted_nulls (char *);
/* Perform quote removal on STRING. If QUOTED > 0, assume we are obeying the
backslash quoting rules for within double quotes. */
-extern char *string_quote_removal PARAMS((char *, int));
+extern char *string_quote_removal (char *, int);
/* Perform quote removal on word WORD. This allocates and returns a new
WORD_DESC *. */
-extern WORD_DESC *word_quote_removal PARAMS((WORD_DESC *, int));
+extern WORD_DESC *word_quote_removal (WORD_DESC *, int);
/* Perform quote removal on all words in LIST. If QUOTED is non-zero,
the members of the list are treated as if they are surrounded by
double quotes. Return a new list, or NULL if LIST is NULL. */
-extern WORD_LIST *word_list_quote_removal PARAMS((WORD_LIST *, int));
+extern WORD_LIST *word_list_quote_removal (WORD_LIST *, int);
/* Called when IFS is changed to maintain some private variables. */
-extern void setifs PARAMS((SHELL_VAR *));
+extern void setifs (SHELL_VAR *);
/* Return the value of $IFS, or " \t\n" if IFS is unset. */
-extern char *getifs PARAMS((void));
+extern char *getifs (void);
/* This splits a single word into a WORD LIST on $IFS, but only if the word
is not quoted. list_string () performs quote removal for us, even if we
don't do any splitting. */
-extern WORD_LIST *word_split PARAMS((WORD_DESC *, char *));
+extern WORD_LIST *word_split (WORD_DESC *, char *);
/* Take the list of words in LIST and do the various substitutions. Return
a new list of words which is the expanded list, and without things like
variable assignments. */
-extern WORD_LIST *expand_words PARAMS((WORD_LIST *));
+extern WORD_LIST *expand_words (WORD_LIST *);
/* Same as expand_words (), but doesn't hack variable or environment
variables. */
-extern WORD_LIST *expand_words_no_vars PARAMS((WORD_LIST *));
+extern WORD_LIST *expand_words_no_vars (WORD_LIST *);
/* Perform the `normal shell expansions' on a WORD_LIST. These are
brace expansion, tilde expansion, parameter and variable substitution,
command substitution, arithmetic expansion, and word splitting. */
-extern WORD_LIST *expand_words_shellexp PARAMS((WORD_LIST *));
+extern WORD_LIST *expand_words_shellexp (WORD_LIST *);
-extern WORD_DESC *command_substitute PARAMS((char *, int, int));
-extern char *pat_subst PARAMS((char *, char *, char *, int));
+extern WORD_DESC *command_substitute (char *, int, int);
+extern char *pat_subst (char *, char *, char *, int);
#if defined (PROCESS_SUBSTITUTION)
-extern int fifos_pending PARAMS((void));
-extern int num_fifos PARAMS((void));
-extern void unlink_fifo_list PARAMS((void));
-extern void unlink_all_fifos PARAMS((void));
-extern void unlink_fifo PARAMS((int));
+extern int fifos_pending (void);
+extern int num_fifos (void);
+extern void unlink_fifo_list (void);
+extern void unlink_all_fifos (void);
+extern void unlink_fifo (int);
-extern void *copy_fifo_list PARAMS((int *));
-extern void close_new_fifos PARAMS((void *, int));
+extern void *copy_fifo_list (int *);
+extern void close_new_fifos (void *, int);
-extern void clear_fifo_list PARAMS((void));
+extern void clear_fifo_list (void);
-extern int find_procsub_child PARAMS((pid_t));
-extern void set_procsub_status PARAMS((int, pid_t, int));
+extern int find_procsub_child (pid_t);
+extern void set_procsub_status (int, pid_t, int);
-extern void wait_procsubs PARAMS((void));
-extern void reap_procsubs PARAMS((void));
+extern void wait_procsubs (void);
+extern void reap_procsubs (void);
#endif
-extern WORD_LIST *list_string_with_quotes PARAMS((char *));
+extern WORD_LIST *list_string_with_quotes (char *);
#if defined (ARRAY_VARS)
-extern char *extract_array_assignment_list PARAMS((char *, int *));
+extern char *extract_array_assignment_list (char *, int *);
#endif
#if defined (COND_COMMAND)
-extern char *remove_backslashes PARAMS((char *));
-extern char *cond_expand_word PARAMS((WORD_DESC *, int));
+extern char *remove_backslashes (char *);
+extern char *cond_expand_word (WORD_DESC *, int);
#endif
/* Flags for skip_to_delim */
#define SD_ARITHEXP 0x400 /* skip_to_delim during arithmetic expansion */
#define SD_NOERROR 0x800 /* don't print error messages */
-extern int skip_to_delim PARAMS((char *, int, char *, int));
+extern int skip_to_delim (char *, int, char *, int);
#if defined (BANG_HISTORY)
-extern int skip_to_histexp PARAMS((char *, int, char *, int));
+extern int skip_to_histexp (char *, int, char *, int);
#endif
#if defined (READLINE)
-extern int char_is_quoted PARAMS((char *, int));
-extern int unclosed_pair PARAMS((char *, int, char *));
-extern WORD_LIST *split_at_delims PARAMS((char *, int, const char *, int, int, int *, int *));
+extern int char_is_quoted (char *, int);
+extern int unclosed_pair (char *, int, char *);
+extern WORD_LIST *split_at_delims (char *, int, const char *, int, int, int *, int *);
#endif
/* Variables used to keep track of the characters in IFS. */
/* Is the first character of STRING a quoted NULL character? */
#define QUOTED_NULL(string) ((string)[0] == CTLNUL && (string)[1] == '\0')
-extern void invalidate_cached_quoted_dollar_at PARAMS((void));
+extern void invalidate_cached_quoted_dollar_at (void);
#endif /* !_SUBST_H_ */
/* bashversion.c -- Display bash version information. */
-/* 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.
extern char *dist_version;
extern int patch_level;
-extern char *shell_version_string PARAMS((void));
-extern void show_shell_version PARAMS((int));
+extern char *shell_version_string (void);
+extern void show_shell_version (int);
char *shell_name = "bash";
char *progname;
/* mksignames.c -- Create and write `signames.h', which contains an array of
signal names. */
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
"/* A translation list so we can be polite to our users. */\n");
#if defined (CROSS_COMPILING)
fprintf (stream, "extern char *signal_names[];\n\n");
- fprintf (stream, "extern void initialize_signames PARAMS((void));\n\n");
+ fprintf (stream, "extern void initialize_signames (void);\n\n");
#else
fprintf (stream, "char *signal_names[NSIG + 4] = {\n");
# in the makefile. This creates a file named by the -o option,
# otherwise everything is echoed to the standard output.
-# Copyright (C) 1996-2020 Free Software Foundation, Inc.
+# Copyright (C) 1996-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
# extern function declarations
#echo
#echo '/* Functions from version.c. */'
-#echo 'extern char *shell_version_string PARAMS((void));'
-#echo 'extern void show_shell_version PARAMS((int));'
+#echo 'extern char *shell_version_string (void);'
+#echo 'extern void show_shell_version (int);'
if [ -n "$inc_build" ]; then
# Make sure we can write to .build
/* test.h -- external interface to the conditional command code. */
-/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#define TEST_LOCALE 0x04
#define TEST_ARRAYEXP 0x08 /* array subscript expansion */
-extern int test_unop PARAMS((char *));
-extern int test_binop PARAMS((char *));
+extern int test_unop (char *);
+extern int test_binop (char *);
-extern int unary_test PARAMS((char *, char *, int));
-extern int binary_test PARAMS((char *, char *, char *, int));
+extern int unary_test (char *, char *, int);
+extern int binary_test (char *, char *, char *, int);
-extern int test_command PARAMS((int, char **));
+extern int test_command (int, char **);
#endif /* _TEST_H_ */
/* trap.h -- data structures used in the trap mechanism. */
-/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern int suppress_debug_trap_verbose;
/* Externally-visible functions declared in trap.c. */
-extern void initialize_traps PARAMS((void));
-
-extern void run_pending_traps PARAMS((void));
-
-extern void queue_sigchld_trap PARAMS((int));
-extern void maybe_set_sigchld_trap PARAMS((char *));
-extern void set_impossible_sigchld_trap PARAMS((void));
-extern void set_sigchld_trap PARAMS((char *));
-
-extern void set_debug_trap PARAMS((char *));
-extern void set_error_trap PARAMS((char *));
-extern void set_return_trap PARAMS((char *));
-
-extern void maybe_set_debug_trap PARAMS((char *));
-extern void maybe_set_error_trap PARAMS((char *));
-extern void maybe_set_return_trap PARAMS((char *));
-
-extern void set_sigint_trap PARAMS((char *));
-extern void set_signal PARAMS((int, char *));
-
-extern void restore_default_signal PARAMS((int));
-extern void ignore_signal PARAMS((int));
-extern int run_exit_trap PARAMS((void));
-extern void run_trap_cleanup PARAMS((int));
-extern int run_debug_trap PARAMS((void));
-extern void run_error_trap PARAMS((void));
-extern void run_return_trap PARAMS((void));
-
-extern void free_trap_strings PARAMS((void));
-extern void reset_signal_handlers PARAMS((void));
-extern void restore_original_signals PARAMS((void));
-extern void restore_traps PARAMS((void));
-
-extern void get_original_signal PARAMS((int));
-extern void get_all_original_signals PARAMS((void));
-
-extern char *signal_name PARAMS((int));
-
-extern int decode_signal PARAMS((char *, int));
-extern void run_interrupt_trap PARAMS((int));
-extern int maybe_call_trap_handler PARAMS((int));
-extern int signal_is_special PARAMS((int));
-extern int signal_is_trapped PARAMS((int));
-extern int signal_is_pending PARAMS((int));
-extern int signal_is_ignored PARAMS((int));
-extern int signal_is_hard_ignored PARAMS((int));
-extern void set_signal_hard_ignored PARAMS((int));
-extern void set_signal_ignored PARAMS((int));
-extern int signal_in_progress PARAMS((int));
-
-extern void set_trap_state PARAMS((int));
-
-extern int next_pending_trap PARAMS((int));
-extern int first_pending_trap PARAMS((void));
-extern void clear_pending_traps PARAMS((void));
-extern int any_signals_trapped PARAMS((void));
-extern void check_signals PARAMS((void));
-extern void check_signals_and_traps PARAMS((void));
+extern void initialize_traps (void);
+
+extern void run_pending_traps (void);
+
+extern void queue_sigchld_trap (int);
+extern void maybe_set_sigchld_trap (char *);
+extern void set_impossible_sigchld_trap (void);
+extern void set_sigchld_trap (char *);
+
+extern void set_debug_trap (char *);
+extern void set_error_trap (char *);
+extern void set_return_trap (char *);
+
+extern void maybe_set_debug_trap (char *);
+extern void maybe_set_error_trap (char *);
+extern void maybe_set_return_trap (char *);
+
+extern void set_sigint_trap (char *);
+extern void set_signal (int, char *);
+
+extern void restore_default_signal (int);
+extern void ignore_signal (int);
+extern int run_exit_trap (void);
+extern void run_trap_cleanup (int);
+extern int run_debug_trap (void);
+extern void run_error_trap (void);
+extern void run_return_trap (void);
+
+extern void free_trap_strings (void);
+extern void reset_signal_handlers (void);
+extern void restore_original_signals (void);
+extern void restore_traps (void);
+
+extern void get_original_signal (int);
+extern void get_all_original_signals (void);
+
+extern char *signal_name (int);
+
+extern int decode_signal (char *, int);
+extern void run_interrupt_trap (int);
+extern int maybe_call_trap_handler (int);
+extern int signal_is_special (int);
+extern int signal_is_trapped (int);
+extern int signal_is_pending (int);
+extern int signal_is_ignored (int);
+extern int signal_is_hard_ignored (int);
+extern void set_signal_hard_ignored (int);
+extern void set_signal_ignored (int);
+extern int signal_in_progress (int);
+
+extern void set_trap_state (int);
+
+extern int next_pending_trap (int);
+extern int first_pending_trap (void);
+extern void clear_pending_traps (void);
+extern int any_signals_trapped (void);
+extern void check_signals (void);
+extern void check_signals_and_traps (void);
#endif /* _TRAP_H_ */
#if !defined (_UNWIND_PROT_H)
#define _UNWIND_PROT_H
-extern void uwp_init PARAMS((void));
+extern void uwp_init (void);
/* Run a function without interrupts. */
-extern void begin_unwind_frame PARAMS((char *));
-extern void discard_unwind_frame PARAMS((char *));
-extern void run_unwind_frame PARAMS((char *));
+extern void begin_unwind_frame (char *);
+extern void discard_unwind_frame (char *);
+extern void run_unwind_frame (char *);
extern void add_unwind_protect (); /* Not portable to arbitrary C99 hosts. */
-extern void remove_unwind_protect PARAMS((void));
-extern void run_unwind_protects PARAMS((void));
-extern void clear_unwind_protect_list PARAMS((int));
-extern int have_unwind_protects PARAMS((void));
-extern int unwind_protect_tag_on_stack PARAMS((const char *));
-extern void uwp_init PARAMS((void));
+extern void remove_unwind_protect (void);
+extern void run_unwind_protects (void);
+extern void clear_unwind_protect_list (int);
+extern int have_unwind_protects (void);
+extern int unwind_protect_tag_on_stack (const char *);
+extern void uwp_init (void);
/* Define for people who like their code to look a certain way. */
#define end_unwind_frame()
/* How to protect a variable. */
#define unwind_protect_var(X) unwind_protect_mem ((char *)&(X), sizeof (X))
-extern void unwind_protect_mem PARAMS((char *, int));
+extern void unwind_protect_mem (char *, int);
/* Backwards compatibility */
#define unwind_protect_int unwind_protect_var
/* What a shell variable looks like. */
-typedef struct variable *sh_var_value_func_t PARAMS((struct variable *));
-typedef struct variable *sh_var_assign_func_t PARAMS((struct variable *, char *, arrayind_t, char *));
+typedef struct variable *sh_var_value_func_t (struct variable *);
+typedef struct variable *sh_var_assign_func_t (struct variable *, char *, arrayind_t, char *);
/* For the future */
union _value {
#define INVALID_NAMEREF_VALUE (void *)&nameref_invalid_value
/* Stuff for hacking variables. */
-typedef int sh_var_map_func_t PARAMS((SHELL_VAR *));
+typedef int sh_var_map_func_t (SHELL_VAR *);
/* Where we keep the variables and functions */
extern VAR_CONTEXT *global_variables;
extern int localvar_inherit; /* declared in variables.c */
-extern void initialize_shell_variables PARAMS((char **, int));
-
-extern int validate_inherited_value PARAMS((SHELL_VAR *, int));
-
-extern SHELL_VAR *set_if_not PARAMS((char *, char *));
-
-extern void sh_set_lines_and_columns PARAMS((int, int));
-extern void set_pwd PARAMS((void));
-extern void set_ppid PARAMS((void));
-extern void make_funcname_visible PARAMS((int));
-
-extern SHELL_VAR *var_lookup PARAMS((const char *, VAR_CONTEXT *));
-
-extern SHELL_VAR *find_function PARAMS((const char *));
-extern FUNCTION_DEF *find_function_def PARAMS((const char *));
-extern SHELL_VAR *find_variable PARAMS((const char *));
-extern SHELL_VAR *find_variable_noref PARAMS((const char *));
-extern SHELL_VAR *find_variable_last_nameref PARAMS((const char *, int));
-extern SHELL_VAR *find_global_variable_last_nameref PARAMS((const char *, int));
-extern SHELL_VAR *find_variable_nameref PARAMS((SHELL_VAR *));
-extern SHELL_VAR *find_variable_nameref_for_create PARAMS((const char *, int));
-extern SHELL_VAR *find_variable_nameref_for_assignment PARAMS((const char *, int));
-/*extern SHELL_VAR *find_variable_internal PARAMS((const char *, int));*/
-extern SHELL_VAR *find_variable_tempenv PARAMS((const char *));
-extern SHELL_VAR *find_variable_notempenv PARAMS((const char *));
-extern SHELL_VAR *find_global_variable PARAMS((const char *));
-extern SHELL_VAR *find_global_variable_noref PARAMS((const char *));
-extern SHELL_VAR *find_shell_variable PARAMS((const char *));
-extern SHELL_VAR *find_tempenv_variable PARAMS((const char *));
-extern SHELL_VAR *find_variable_no_invisible PARAMS((const char *));
-extern SHELL_VAR *find_variable_for_assignment PARAMS((const char *));
-extern char *nameref_transform_name PARAMS((char *, int));
-extern SHELL_VAR *copy_variable PARAMS((SHELL_VAR *));
-extern SHELL_VAR *make_local_variable PARAMS((const char *, int));
-extern SHELL_VAR *bind_variable PARAMS((const char *, char *, int));
-extern SHELL_VAR *bind_global_variable PARAMS((const char *, char *, int));
-extern SHELL_VAR *bind_function PARAMS((const char *, COMMAND *));
-
-extern void bind_function_def PARAMS((const char *, FUNCTION_DEF *, int));
-
-extern SHELL_VAR **map_over PARAMS((sh_var_map_func_t *, VAR_CONTEXT *));
-SHELL_VAR **map_over_funcs PARAMS((sh_var_map_func_t *));
+extern void initialize_shell_variables (char **, int);
+
+extern int validate_inherited_value (SHELL_VAR *, int);
+
+extern SHELL_VAR *set_if_not (char *, char *);
+
+extern void sh_set_lines_and_columns (int, int);
+extern void set_pwd (void);
+extern void set_ppid (void);
+extern void make_funcname_visible (int);
+
+extern SHELL_VAR *var_lookup (const char *, VAR_CONTEXT *);
+
+extern SHELL_VAR *find_function (const char *);
+extern FUNCTION_DEF *find_function_def (const char *);
+extern SHELL_VAR *find_variable (const char *);
+extern SHELL_VAR *find_variable_noref (const char *);
+extern SHELL_VAR *find_variable_last_nameref (const char *, int);
+extern SHELL_VAR *find_global_variable_last_nameref (const char *, int);
+extern SHELL_VAR *find_variable_nameref (SHELL_VAR *);
+extern SHELL_VAR *find_variable_nameref_for_create (const char *, int);
+extern SHELL_VAR *find_variable_nameref_for_assignment (const char *, int);
+/*extern SHELL_VAR *find_variable_internal (const char *, int);*/
+extern SHELL_VAR *find_variable_tempenv (const char *);
+extern SHELL_VAR *find_variable_notempenv (const char *);
+extern SHELL_VAR *find_global_variable (const char *);
+extern SHELL_VAR *find_global_variable_noref (const char *);
+extern SHELL_VAR *find_shell_variable (const char *);
+extern SHELL_VAR *find_tempenv_variable (const char *);
+extern SHELL_VAR *find_variable_no_invisible (const char *);
+extern SHELL_VAR *find_variable_for_assignment (const char *);
+extern char *nameref_transform_name (char *, int);
+extern SHELL_VAR *copy_variable (SHELL_VAR *);
+extern SHELL_VAR *make_local_variable (const char *, int);
+extern SHELL_VAR *bind_variable (const char *, char *, int);
+extern SHELL_VAR *bind_global_variable (const char *, char *, int);
+extern SHELL_VAR *bind_function (const char *, COMMAND *);
+
+extern void bind_function_def (const char *, FUNCTION_DEF *, int);
+
+extern SHELL_VAR **map_over (sh_var_map_func_t *, VAR_CONTEXT *);
+SHELL_VAR **map_over_funcs (sh_var_map_func_t *);
-extern SHELL_VAR **all_shell_variables PARAMS((void));
-extern SHELL_VAR **all_shell_functions PARAMS((void));
-extern SHELL_VAR **all_visible_variables PARAMS((void));
-extern SHELL_VAR **all_visible_functions PARAMS((void));
-extern SHELL_VAR **all_exported_variables PARAMS((void));
-extern SHELL_VAR **local_exported_variables PARAMS((void));
-extern SHELL_VAR **all_local_variables PARAMS((int));
+extern SHELL_VAR **all_shell_variables (void);
+extern SHELL_VAR **all_shell_functions (void);
+extern SHELL_VAR **all_visible_variables (void);
+extern SHELL_VAR **all_visible_functions (void);
+extern SHELL_VAR **all_exported_variables (void);
+extern SHELL_VAR **local_exported_variables (void);
+extern SHELL_VAR **all_local_variables (int);
#if defined (ARRAY_VARS)
-extern SHELL_VAR **all_array_variables PARAMS((void));
+extern SHELL_VAR **all_array_variables (void);
#endif
-extern char **all_variables_matching_prefix PARAMS((const char *));
-
-extern char **make_var_array PARAMS((HASH_TABLE *));
-extern char **add_or_supercede_exported_var PARAMS((char *, int));
-
-extern char *get_variable_value PARAMS((SHELL_VAR *));
-extern char *get_string_value PARAMS((const char *));
-extern char *sh_get_env_value PARAMS((const char *));
-extern char *make_variable_value PARAMS((SHELL_VAR *, char *, int));
-
-extern SHELL_VAR *bind_variable_value PARAMS((SHELL_VAR *, char *, int));
-extern SHELL_VAR *bind_int_variable PARAMS((char *, char *, int));
-extern SHELL_VAR *bind_var_to_int PARAMS((char *, intmax_t, int));
-
-extern int assign_in_env PARAMS((WORD_DESC *, int));
-
-extern int unbind_variable PARAMS((const char *));
-extern int check_unbind_variable PARAMS((const char *));
-extern int unbind_nameref PARAMS((const char *));
-extern int unbind_variable_noref PARAMS((const char *));
-extern int unbind_global_variable PARAMS((const char *));
-extern int unbind_global_variable_noref PARAMS((const char *));
-extern int unbind_func PARAMS((const char *));
-extern int unbind_function_def PARAMS((const char *));
-extern int delete_var PARAMS((const char *, VAR_CONTEXT *));
-extern int makunbound PARAMS((const char *, VAR_CONTEXT *));
-extern int kill_local_variable PARAMS((const char *));
-
-extern void delete_all_variables PARAMS((HASH_TABLE *));
-extern void delete_all_contexts PARAMS((VAR_CONTEXT *));
-extern void reset_local_contexts PARAMS((void));
-
-extern VAR_CONTEXT *new_var_context PARAMS((char *, int));
-extern void dispose_var_context PARAMS((VAR_CONTEXT *));
-extern VAR_CONTEXT *push_var_context PARAMS((char *, int, HASH_TABLE *));
-extern void pop_var_context PARAMS((void));
-extern VAR_CONTEXT *push_scope PARAMS((int, HASH_TABLE *));
-extern void pop_scope PARAMS((int));
-
-extern void clear_dollar_vars PARAMS((void));
-
-extern void push_context PARAMS((char *, int, HASH_TABLE *));
-extern void pop_context PARAMS((void));
-extern void push_dollar_vars PARAMS((void));
-extern void pop_dollar_vars PARAMS((void));
-extern void dispose_saved_dollar_vars PARAMS((void));
-
-extern void init_bash_argv PARAMS((void));
-extern void save_bash_argv PARAMS((void));
-extern void push_args PARAMS((WORD_LIST *));
-extern void pop_args PARAMS((void));
-
-extern void adjust_shell_level PARAMS((int));
-extern void non_unsettable PARAMS((char *));
-extern void dispose_variable PARAMS((SHELL_VAR *));
-extern void dispose_used_env_vars PARAMS((void));
-extern void dispose_function_env PARAMS((void));
-extern void dispose_builtin_env PARAMS((void));
-extern void merge_temporary_env PARAMS((void));
-extern void flush_temporary_env PARAMS((void));
-extern void merge_builtin_env PARAMS((void));
-extern void kill_all_local_variables PARAMS((void));
-
-extern void set_var_read_only PARAMS((char *));
-extern void set_func_read_only PARAMS((const char *));
-extern void set_var_auto_export PARAMS((char *));
-extern void set_func_auto_export PARAMS((const char *));
-
-extern void sort_variables PARAMS((SHELL_VAR **));
-
-extern int chkexport PARAMS((char *));
-extern void maybe_make_export_env PARAMS((void));
-extern void update_export_env_inplace PARAMS((char *, int, char *));
-extern void put_command_name_into_env PARAMS((char *));
-extern void put_gnu_argv_flags_into_env PARAMS((intmax_t, char *));
-
-extern void print_var_list PARAMS((SHELL_VAR **));
-extern void print_func_list PARAMS((SHELL_VAR **));
-extern void print_assignment PARAMS((SHELL_VAR *));
-extern void print_var_value PARAMS((SHELL_VAR *, int));
-extern void print_var_function PARAMS((SHELL_VAR *));
+extern char **all_variables_matching_prefix (const char *);
+
+extern char **make_var_array (HASH_TABLE *);
+extern char **add_or_supercede_exported_var (char *, int);
+
+extern char *get_variable_value (SHELL_VAR *);
+extern char *get_string_value (const char *);
+extern char *sh_get_env_value (const char *);
+extern char *make_variable_value (SHELL_VAR *, char *, int);
+
+extern SHELL_VAR *bind_variable_value (SHELL_VAR *, char *, int);
+extern SHELL_VAR *bind_int_variable (char *, char *, int);
+extern SHELL_VAR *bind_var_to_int (char *, intmax_t, int);
+
+extern int assign_in_env (WORD_DESC *, int);
+
+extern int unbind_variable (const char *);
+extern int check_unbind_variable (const char *);
+extern int unbind_nameref (const char *);
+extern int unbind_variable_noref (const char *);
+extern int unbind_global_variable (const char *);
+extern int unbind_global_variable_noref (const char *);
+extern int unbind_func (const char *);
+extern int unbind_function_def (const char *);
+extern int delete_var (const char *, VAR_CONTEXT *);
+extern int makunbound (const char *, VAR_CONTEXT *);
+extern int kill_local_variable (const char *);
+
+extern void delete_all_variables (HASH_TABLE *);
+extern void delete_all_contexts (VAR_CONTEXT *);
+extern void reset_local_contexts (void);
+
+extern VAR_CONTEXT *new_var_context (char *, int);
+extern void dispose_var_context (VAR_CONTEXT *);
+extern VAR_CONTEXT *push_var_context (char *, int, HASH_TABLE *);
+extern void pop_var_context (void);
+extern VAR_CONTEXT *push_scope (int, HASH_TABLE *);
+extern void pop_scope (int);
+
+extern void clear_dollar_vars (void);
+
+extern void push_context (char *, int, HASH_TABLE *);
+extern void pop_context (void);
+extern void push_dollar_vars (void);
+extern void pop_dollar_vars (void);
+extern void dispose_saved_dollar_vars (void);
+
+extern void init_bash_argv (void);
+extern void save_bash_argv (void);
+extern void push_args (WORD_LIST *);
+extern void pop_args (void);
+
+extern void adjust_shell_level (int);
+extern void non_unsettable (char *);
+extern void dispose_variable (SHELL_VAR *);
+extern void dispose_used_env_vars (void);
+extern void dispose_function_env (void);
+extern void dispose_builtin_env (void);
+extern void merge_temporary_env (void);
+extern void flush_temporary_env (void);
+extern void merge_builtin_env (void);
+extern void kill_all_local_variables (void);
+
+extern void set_var_read_only (char *);
+extern void set_func_read_only (const char *);
+extern void set_var_auto_export (char *);
+extern void set_func_auto_export (const char *);
+
+extern void sort_variables (SHELL_VAR **);
+
+extern int chkexport (char *);
+extern void maybe_make_export_env (void);
+extern void update_export_env_inplace (char *, int, char *);
+extern void put_command_name_into_env (char *);
+extern void put_gnu_argv_flags_into_env (intmax_t, char *);
+
+extern void print_var_list (SHELL_VAR **);
+extern void print_func_list (SHELL_VAR **);
+extern void print_assignment (SHELL_VAR *);
+extern void print_var_value (SHELL_VAR *, int);
+extern void print_var_function (SHELL_VAR *);
#if defined (ARRAY_VARS)
-extern SHELL_VAR *make_new_array_variable PARAMS((char *));
-extern SHELL_VAR *make_local_array_variable PARAMS((char *, int));
+extern SHELL_VAR *make_new_array_variable (char *);
+extern SHELL_VAR *make_local_array_variable (char *, int);
-extern SHELL_VAR *make_new_assoc_variable PARAMS((char *));
-extern SHELL_VAR *make_local_assoc_variable PARAMS((char *, int));
+extern SHELL_VAR *make_new_assoc_variable (char *);
+extern SHELL_VAR *make_local_assoc_variable (char *, int);
-extern void set_pipestatus_array PARAMS((int *, int));
-extern ARRAY *save_pipestatus_array PARAMS((void));
-extern void restore_pipestatus_array PARAMS((ARRAY *));
+extern void set_pipestatus_array (int *, int);
+extern ARRAY *save_pipestatus_array (void);
+extern void restore_pipestatus_array (ARRAY *);
#endif
-extern void set_pipestatus_from_exit PARAMS((int));
+extern void set_pipestatus_from_exit (int);
/* The variable in NAME has just had its state changed. Check to see if it
is one of the special ones where something special happens. */
-extern void stupidly_hack_special_variables PARAMS((char *));
+extern void stupidly_hack_special_variables (char *);
/* Reinitialize some special variables that have external effects upon unset
when the shell reinitializes itself. */
-extern void reinit_special_variables PARAMS((void));
+extern void reinit_special_variables (void);
-extern int get_random_number PARAMS((void));
+extern int get_random_number (void);
/* The `special variable' functions that get called when a particular
variable is set. */
-extern void sv_ifs PARAMS((char *));
-extern void sv_path PARAMS((char *));
-extern void sv_mail PARAMS((char *));
-extern void sv_funcnest PARAMS((char *));
-extern void sv_execignore PARAMS((char *));
-extern void sv_globignore PARAMS((char *));
-extern void sv_ignoreeof PARAMS((char *));
-extern void sv_strict_posix PARAMS((char *));
-extern void sv_optind PARAMS((char *));
-extern void sv_opterr PARAMS((char *));
-extern void sv_locale PARAMS((char *));
-extern void sv_xtracefd PARAMS((char *));
-extern void sv_shcompat PARAMS((char *));
+extern void sv_ifs (char *);
+extern void sv_path (char *);
+extern void sv_mail (char *);
+extern void sv_funcnest (char *);
+extern void sv_execignore (char *);
+extern void sv_globignore (char *);
+extern void sv_ignoreeof (char *);
+extern void sv_strict_posix (char *);
+extern void sv_optind (char *);
+extern void sv_opterr (char *);
+extern void sv_locale (char *);
+extern void sv_xtracefd (char *);
+extern void sv_shcompat (char *);
#if defined (READLINE)
-extern void sv_comp_wordbreaks PARAMS((char *));
-extern void sv_terminal PARAMS((char *));
-extern void sv_hostfile PARAMS((char *));
-extern void sv_winsize PARAMS((char *));
+extern void sv_comp_wordbreaks (char *);
+extern void sv_terminal (char *);
+extern void sv_hostfile (char *);
+extern void sv_winsize (char *);
#endif
#if defined (__CYGWIN__)
-extern void sv_home PARAMS((char *));
+extern void sv_home (char *);
#endif
#if defined (HISTORY)
-extern void sv_histsize PARAMS((char *));
-extern void sv_histignore PARAMS((char *));
-extern void sv_history_control PARAMS((char *));
+extern void sv_histsize (char *);
+extern void sv_histignore (char *);
+extern void sv_history_control (char *);
# if defined (BANG_HISTORY)
-extern void sv_histchars PARAMS((char *));
+extern void sv_histchars (char *);
# endif
-extern void sv_histtimefmt PARAMS((char *));
+extern void sv_histtimefmt (char *);
#endif /* HISTORY */
#if defined (HAVE_TZSET)
-extern void sv_tz PARAMS((char *));
+extern void sv_tz (char *);
#endif
#if defined (JOB_CONTROL)
-extern void sv_childmax PARAMS((char *));
+extern void sv_childmax (char *);
#endif
#endif /* !_VARIABLES_H_ */
/* Functions for getting, setting, and displaying the shell version. */
/* Forward declarations so we don't have to include externs.h */
-extern char *shell_version_string PARAMS((void));
-extern void show_shell_version PARAMS((int));
+extern char *shell_version_string (void);
+extern void show_shell_version (int);
/* Give version information about this shell. */
char *
/* Functions for getting, setting, and displaying the shell version. */
/* Forward declarations so we don't have to include externs.h */
-extern char *shell_version_string PARAMS((void));
-extern void show_shell_version PARAMS((int));
+extern char *shell_version_string (void);
+extern void show_shell_version (int);
/* Give version information about this shell. */
char *
} while (0)
static size_t
-findbrk ()
+findbrk (void)
{
FINDBRK();
return (char *)sbrk (0) - (char *)lbreak;
#endif
static void
-allocerr (func, bytes)
- const char *func;
- size_t bytes;
+allocerr (const char *func, size_t bytes)
{
#if HAVE_SBRK && defined (USING_BASH_MALLOC)
allocated = findbrk ();
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;
}
PTR_T
-xrealloc (pointer, bytes)
- PTR_T pointer;
- size_t bytes;
+xrealloc (PTR_T pointer, size_t bytes)
{
PTR_T temp;
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
-xfree (string)
- PTR_T string;
+xfree (PTR_T string)
{
if (string)
free (string);
#include <malloc/shmalloc.h>
static void
-sh_allocerr (func, bytes, file, line)
- const char *func;
- size_t bytes;
- char *file;
- int line;
+sh_allocerr (const char *func, size_t bytes, char *file, int line)
{
#if HAVE_SBRK
allocated = findbrk ();
}
PTR_T
-sh_xmalloc (bytes, file, line)
- size_t bytes;
- char *file;
- int line;
+sh_xmalloc (size_t bytes, char *file, int line)
{
PTR_T temp;
}
PTR_T
-sh_xrealloc (pointer, bytes, file, line)
- PTR_T pointer;
- size_t bytes;
- char *file;
- int line;
+sh_xrealloc (PTR_T pointer, size_t bytes, char *file, int line)
{
PTR_T temp;
}
void
-sh_xfree (string, file, line)
- PTR_T string;
- char *file;
- int line;
+sh_xfree (PTR_T string, char *file, int line)
{
if (string)
sh_free (string, file, line);
/* xmalloc.h -- defines for the `x' memory allocation functions */
-/* 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.
#endif /* PTR_T */
/* Allocation functions in xmalloc.c */
-extern PTR_T xmalloc PARAMS((size_t));
-extern PTR_T xrealloc PARAMS((void *, size_t));
-extern void xfree PARAMS((void *));
+extern PTR_T xmalloc (size_t);
+extern PTR_T xrealloc (void *, size_t);
+extern void xfree (void *);
#if defined(USING_BASH_MALLOC) && !defined (DISABLE_MALLOC_WRAPPERS)
-extern PTR_T sh_xmalloc PARAMS((size_t, const char *, int));
-extern PTR_T sh_xrealloc PARAMS((void *, size_t, const char *, int));
-extern void sh_xfree PARAMS((void *, const char *, int));
+extern PTR_T sh_xmalloc (size_t, const char *, int);
+extern PTR_T sh_xrealloc (void *, size_t, const char *, int);
+extern void sh_xfree (void *, const char *, int);
#define xmalloc(x) sh_xmalloc((x), __FILE__, __LINE__)
#define xrealloc(x, n) sh_xrealloc((x), (n), __FILE__, __LINE__)
#endif
#define free(x) sh_xfree((x), __FILE__, __LINE__)
-extern PTR_T sh_malloc PARAMS((size_t, const char *, int));
+extern PTR_T sh_malloc (size_t, const char *, int);
#ifdef malloc
#undef malloc