diff -uprk.orig bash-2.05b.orig/bashjmp.h bash-2.05b/bashjmp.h --- bash-2.05b.orig/bashjmp.h 1999-08-05 15:24:12 +0400 +++ bash-2.05b/bashjmp.h 2002-09-16 03:17:09 +0400 @@ -27,7 +27,9 @@ extern procenv_t top_level; extern procenv_t subshell_top_level; extern procenv_t return_catch; /* used by `return' builtin */ +#ifdef INCLUDE_UNUSED #define SHFUNC_RETURN() longjmp (return_catch, 1) +#endif #define COPY_PROCENV(old, save) \ xbcopy ((char *)old, (char *)save, sizeof (procenv_t)); diff -uprk.orig bash-2.05b.orig/bashline.c bash-2.05b/bashline.c --- bash-2.05b.orig/bashline.c 2002-05-07 23:52:42 +0400 +++ bash-2.05b/bashline.c 2002-09-16 03:17:09 +0400 @@ -542,7 +542,7 @@ snarf_hosts_from_file (filename) if (file == 0) return; - while (temp = fgets (buffer, 255, file)) + while ((temp = fgets (buffer, 255, file))) { /* Skip to first character. */ for (i = 0; buffer[i] && cr_whitespace (buffer[i]); i++) @@ -1603,7 +1603,7 @@ bash_groupname_completion_function (text setgrent (); } - while (grent = getgrent ()) + while ((grent = getgrent ())) { if (gnamelen == 0 || (STREQN (gname, grent->gr_name, gnamelen))) break; @@ -2757,7 +2757,7 @@ isolate_sequence (string, ind, need_dquo if (startp) *startp = delim ? ++i : i; - for (passc = 0; c = string[i]; i++) + for (passc = 0; (c = string[i]); i++) { if (passc) { diff -uprk.orig bash-2.05b.orig/braces.c bash-2.05b/braces.c --- bash-2.05b.orig/braces.c 2002-05-06 21:50:40 +0400 +++ bash-2.05b/braces.c 2002-09-16 03:17:09 +0400 @@ -260,7 +260,7 @@ brace_gobbler (text, tlen, indx, satisfy level = quoted = pass_next = 0; i = *indx; - while (c = text[i]) + while ((c = text[i])) { if (pass_next) { diff -uprk.orig bash-2.05b.orig/builtins/bind.def bash-2.05b/builtins/bind.def --- bash-2.05b.orig/builtins/bind.def 2002-04-04 20:24:15 +0400 +++ bash-2.05b/builtins/bind.def 2002-09-16 03:17:09 +0400 @@ -123,6 +123,8 @@ bind_builtin (list) rl_outstream = stdout; + cmd_seq = NULL; /* never used */ + reset_internal_getopt (); while ((opt = internal_getopt (list, "lvpVPsSf:q:u:m:r:x:")) != EOF) { diff -uprk.orig bash-2.05b.orig/builtins/cd.def bash-2.05b/builtins/cd.def --- bash-2.05b.orig/builtins/cd.def 2002-07-15 22:51:39 +0400 +++ bash-2.05b/builtins/cd.def 2002-09-16 03:17:09 +0400 @@ -203,13 +203,13 @@ cd_builtin (list) } else if (absolute_pathname (list->word->word)) dirname = list->word->word; - else if (cdpath = get_string_value ("CDPATH")) + else if ((cdpath = get_string_value ("CDPATH"))) { dirname = list->word->word; /* Find directory in $CDPATH. */ path_index = 0; - while (path = extract_colon_unit (cdpath, &path_index)) + while ((path = extract_colon_unit (cdpath, &path_index))) { /* OPT is 1 if the path element is non-empty */ opt = path[0] != '\0'; diff -uprk.orig bash-2.05b.orig/builtins/common.c bash-2.05b/builtins/common.c --- bash-2.05b.orig/builtins/common.c 2002-06-28 20:24:31 +0400 +++ bash-2.05b/builtins/common.c 2002-09-16 03:17:09 +0400 @@ -244,7 +244,7 @@ sh_nojobs (s) char *s; { if (s) - builtin_error ("%s: no job control"); + builtin_error ("%s: no job control", s); else builtin_error ("no job control"); } diff -uprk.orig bash-2.05b.orig/builtins/declare.def bash-2.05b/builtins/declare.def --- bash-2.05b.orig/builtins/declare.def 2002-04-08 21:20:55 +0400 +++ bash-2.05b/builtins/declare.def 2002-09-16 03:17:09 +0400 @@ -238,7 +238,7 @@ declare_internal (list, local_var) #if defined (ARRAY_VARS) compound_array_assign = simple_array_assign = 0; subscript_start = (char *)NULL; - if (t = strchr (name, '[')) /* ] */ + if ((t = strchr (name, '['))) /* ] */ { subscript_start = t; *t = '\0'; diff -uprk.orig bash-2.05b.orig/builtins/echo.def bash-2.05b/builtins/echo.def --- bash-2.05b.orig/builtins/echo.def 2002-03-19 18:45:28 +0300 +++ bash-2.05b/builtins/echo.def 2002-09-16 03:17:09 +0400 @@ -110,7 +110,7 @@ echo_builtin (list) /* All of the options in TEMP are valid options to ECHO. Handle them. */ - while (i = *temp++) + while ((i = *temp++)) { switch (i) { diff -uprk.orig bash-2.05b.orig/builtins/enable.def bash-2.05b/builtins/enable.def --- bash-2.05b.orig/builtins/enable.def 2002-03-19 21:54:00 +0300 +++ bash-2.05b/builtins/enable.def 2002-09-16 03:17:09 +0400 @@ -95,6 +95,8 @@ enable_builtin (list) int opt, filter; #if defined (HAVE_DLOPEN) && defined (HAVE_DLSYM) char *filename; + + filename = NULL; #endif result = EXECUTION_SUCCESS; @@ -334,7 +336,7 @@ dyn_load_builtin (list, flags, filename) b->flags |= SPECIAL_BUILTIN; b->handle = handle; - if (old_builtin = builtin_address_internal (name, 1)) + if ((old_builtin = builtin_address_internal (name, 1))) { replaced++; FASTCOPY ((char *)b, (char *)old_builtin, sizeof (struct builtin)); diff -uprk.orig bash-2.05b.orig/builtins/evalstring.c bash-2.05b/builtins/evalstring.c --- bash-2.05b.orig/builtins/evalstring.c 2002-04-04 22:38:50 +0400 +++ bash-2.05b/builtins/evalstring.c 2002-09-16 03:17:09 +0400 @@ -52,6 +52,8 @@ extern int errno; #endif +extern int zcatfd (int fd, int ofd, const char *fn); + #define IS_BUILTIN(s) (builtin_address_internal(s, 0) != (struct builtin *)NULL) extern int indirection_level, startup_state, subshell_environment; @@ -200,7 +202,7 @@ parse_and_execute (string, from_file, fl dispose_command (global_command); global_command = (COMMAND *)NULL; } - else if (command = global_command) + else if ((command = global_command)) { struct fd_bitmap *bitmap; @@ -293,9 +295,8 @@ static int cat_file (r) REDIRECT *r; { - char lbuf[128], *fn; + char *fn; int fd, rval; - ssize_t nr; if (r->instruction != r_input_direction) return -1; diff -uprk.orig bash-2.05b.orig/builtins/fg_bg.def bash-2.05b/builtins/fg_bg.def --- bash-2.05b.orig/builtins/fg_bg.def 2002-04-08 21:21:32 +0400 +++ bash-2.05b/builtins/fg_bg.def 2002-09-16 03:17:09 +0400 @@ -132,11 +132,9 @@ fg_bg (list, foreground) goto failure; } + old_async_pid = last_asynchronous_pid; if (foreground == 0) - { - old_async_pid = last_asynchronous_pid; - last_asynchronous_pid = jobs[job]->pgrp; /* As per Posix.2 5.4.2 */ - } + last_asynchronous_pid = jobs[job]->pgrp; /* As per Posix.2 5.4.2 */ status = start_job (job, foreground); diff -uprk.orig bash-2.05b.orig/builtins/getopt.c bash-2.05b/builtins/getopt.c --- bash-2.05b.orig/builtins/getopt.c 2002-03-19 20:03:27 +0300 +++ bash-2.05b/builtins/getopt.c 2002-09-16 03:17:09 +0400 @@ -177,7 +177,7 @@ sh_getopt (argc, argv, optstring) nextchar = (char *)NULL; } - if (sh_badopt = (temp == NULL || c == ':')) + if ((sh_badopt = (temp == NULL || c == ':'))) { if (sh_opterr) BADOPT (c); diff -uprk.orig bash-2.05b.orig/builtins/getopts.def bash-2.05b/builtins/getopts.def --- bash-2.05b.orig/builtins/getopts.def 2002-03-19 20:03:06 +0300 +++ bash-2.05b/builtins/getopts.def 2002-09-16 03:17:09 +0400 @@ -164,9 +164,9 @@ dogetopts (argc, argv) special_error = optstr[0] == ':'; + old_opterr = sh_opterr; if (special_error) { - old_opterr = sh_opterr; optstr++; sh_opterr = 0; /* suppress diagnostic messages */ } diff -uprk.orig bash-2.05b.orig/builtins/help.def bash-2.05b/builtins/help.def --- bash-2.05b.orig/builtins/help.def 2002-04-08 21:22:07 +0400 +++ bash-2.05b/builtins/help.def 2002-09-16 03:17:09 +0400 @@ -61,6 +61,8 @@ $END extern int errno; #endif +extern int zcatfd (int fd, int ofd, const char *fn); + static void show_builtin_command_help __P((void)); static void show_longdoc __P((int)); @@ -112,7 +114,7 @@ help_builtin (list) pattern = list->word->word; plen = strlen (pattern); - for (i = 0; name = shell_builtins[i].name; i++) + for (i = 0; (name = shell_builtins[i].name); i++) { QUIT; if ((strncmp (pattern, name, plen) == 0) || diff -uprk.orig bash-2.05b.orig/builtins/history.def bash-2.05b/builtins/history.def --- bash-2.05b.orig/builtins/history.def 2002-03-19 22:06:33 +0300 +++ bash-2.05b/builtins/history.def 2002-09-16 03:17:09 +0400 @@ -95,6 +95,8 @@ history_builtin (list) char *filename, *delete_arg; intmax_t delete_offset; + delete_arg = NULL; /* never used */ + flags = 0; reset_internal_getopt (); while ((opt = internal_getopt (list, "acd:npsrw")) != -1) diff -uprk.orig bash-2.05b.orig/builtins/mkbuiltins.c bash-2.05b/builtins/mkbuiltins.c --- bash-2.05b.orig/builtins/mkbuiltins.c 2002-04-08 21:22:44 +0400 +++ bash-2.05b/builtins/mkbuiltins.c 2002-09-16 03:17:09 +0400 @@ -524,7 +524,7 @@ extract_info (filename, structfile, exte output_cpp_line_info = 1; /* Process each line in the array. */ - for (i = 0; line = defs->lines->array[i]; i++) + for (i = 0; (line = defs->lines->array[i]); i++) { defs->line_number = i; @@ -640,7 +640,7 @@ free_defs (defs) if (defs->builtins) { - for (i = 0; builtin = (BUILTIN_DESC *)defs->builtins->array[i]; i++) + for (i = 0; (builtin = (BUILTIN_DESC *)defs->builtins->array[i]); i++) { free_builtin (builtin); free (builtin); @@ -1357,7 +1357,7 @@ write_documentation (stream, documentati if (string_array) fprintf (stream, " {\n#if defined (HELP_BUILTIN)\n"); - for (i = 0, texinfo = (flags & TEXINFO); line = documentation[i]; i++) + for (i = 0, texinfo = (flags & TEXINFO); (line = documentation[i]); i++) { /* Allow #ifdef's to be written out verbatim. */ if (*line == '#') diff -uprk.orig bash-2.05b.orig/builtins/read.def bash-2.05b/builtins/read.def --- bash-2.05b.orig/builtins/read.def 2002-03-19 22:33:41 +0300 +++ bash-2.05b/builtins/read.def 2002-09-16 03:17:09 +0400 @@ -53,6 +53,7 @@ $END #include "posixstat.h" #include +#include #if defined (HAVE_UNISTD_H) # include diff -uprk.orig bash-2.05b.orig/builtins/setattr.def bash-2.05b/builtins/setattr.def --- bash-2.05b.orig/builtins/setattr.def 2002-06-22 01:11:02 +0400 +++ bash-2.05b/builtins/setattr.def 2002-09-16 03:17:09 +0400 @@ -248,7 +248,7 @@ set_or_show_attributes (list, attribute, if (variable_list) { - for (i = 0; var = variable_list[i]; i++) + for (i = 0; (var = variable_list[i]); i++) { #if defined (ARRAY_VARS) if (arrays_only && array_p (var) == 0) diff -uprk.orig bash-2.05b.orig/builtins/set.def bash-2.05b/builtins/set.def --- bash-2.05b.orig/builtins/set.def 2002-07-11 00:17:20 +0400 +++ bash-2.05b/builtins/set.def 2002-09-16 03:17:09 +0400 @@ -512,7 +512,7 @@ parse_shellopts (value) int vptr; vptr = 0; - while (vname = extract_colon_unit (value, &vptr)) + while ((vname = extract_colon_unit (value, &vptr))) { set_minus_o_option (FLAG_ON, vname); free (vname); @@ -565,7 +565,6 @@ set_builtin (list) WORD_LIST *list; { int on_or_off, flag_name, force_assignment, opts_changed; - WORD_LIST *l; register char *arg; char s[3]; @@ -621,7 +620,7 @@ set_builtin (list) if ((on_or_off = *arg) && (on_or_off == '-' || on_or_off == '+')) { - while (flag_name = *++arg) + while ((flag_name = *++arg)) { if (flag_name == '?') { @@ -739,6 +738,8 @@ unset_builtin (list) int tem; #if defined (ARRAY_VARS) char *t; + + t = NULL; #endif name = list->word->word; diff -uprk.orig bash-2.05b.orig/builtins/type.def bash-2.05b/builtins/type.def --- bash-2.05b.orig/builtins/type.def 2002-03-19 18:41:37 +0300 +++ bash-2.05b/builtins/type.def 2002-09-16 03:17:09 +0400 @@ -328,7 +328,7 @@ describe_command (command, dflags) whether the file is present in our hash table. */ if (all == 0 || (dflags & CDESC_FORCE_PATH)) { - if (full_path = phash_search (command)) + if ((full_path = phash_search (command))) { if (dflags & CDESC_TYPE) puts ("file"); diff -uprk.orig bash-2.05b.orig/builtins/ulimit.def bash-2.05b/builtins/ulimit.def --- bash-2.05b.orig/builtins/ulimit.def 2002-03-19 22:39:14 +0300 +++ bash-2.05b/builtins/ulimit.def 2002-09-16 03:17:09 +0400 @@ -175,7 +175,9 @@ static int set_limit __P((int, RLIMTYPE, static void printone __P((int, RLIMTYPE, int)); static void print_all_limits __P((int)); +#ifdef NOTYET static int set_all_limits __P((int, RLIMTYPE)); +#endif static int filesize __P((RLIMTYPE *)); static int pipesize __P((RLIMTYPE *)); @@ -680,6 +682,7 @@ printone (limind, curlim, pdesc) print_rlimtype ((curlim / limits[limind].block_factor), 1); } +#ifdef NOTYET /* Set all limits to NEWLIM. NEWLIM currently must be RLIM_INFINITY, which causes all limits to be set as high as possible depending on mode (like csh `unlimit'). Returns -1 if NEWLIM is invalid, 0 if all limits @@ -719,5 +722,6 @@ set_all_limits (mode, newlim) } return retval; } +#endif #endif /* !_MINIX */ diff -uprk.orig bash-2.05b.orig/config-bot.h bash-2.05b/config-bot.h --- bash-2.05b.orig/config-bot.h 2002-04-17 01:01:03 +0400 +++ bash-2.05b/config-bot.h 2002-09-16 03:17:09 +0400 @@ -88,7 +88,7 @@ # undef HAVE_STRCOLL #endif -#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && defined (HAVE_NETINET_IN_H) +#if defined (HAVE_SYS_SOCKET_H) && defined (HAVE_GETPEERNAME) && defined (HAVE_NETINET_IN_H) && defined (NETWORK_REDIRECTIONS) # define HAVE_NETWORK #endif diff -uprk.orig bash-2.05b.orig/error.c bash-2.05b/error.c --- bash-2.05b.orig/error.c 2002-06-22 01:56:41 +0400 +++ bash-2.05b/error.c 2002-09-16 03:17:09 +0400 @@ -128,7 +128,6 @@ programming_error (format, va_alist) #endif { va_list args; - char *h; #if defined (JOB_CONTROL) give_terminal_to (shell_pgrp, 0); @@ -143,6 +142,7 @@ programming_error (format, va_alist) #if defined (HISTORY) if (remember_on_history) { + char *h; h = last_history_line (); fprintf (stderr, "last command: %s\n", h ? h : "(null)"); } diff -uprk.orig bash-2.05b.orig/eval.c bash-2.05b/eval.c --- bash-2.05b.orig/eval.c 2002-03-12 17:53:36 +0300 +++ bash-2.05b/eval.c 2002-09-16 03:17:09 +0400 @@ -71,6 +71,8 @@ reader_loop () { int code; + /* XXX: non-atomic update of top_level, do we allow interrupts here? */ + /* XXX: doesn't restore top_level on function return */ code = setjmp (top_level); #if defined (PROCESS_SUBSTITUTION) @@ -133,7 +135,7 @@ reader_loop () dispose_command (global_command); global_command = (COMMAND *)NULL; } - else if (current_command = global_command) + else if ((current_command = global_command)) { global_command = (COMMAND *)NULL; current_command_number++; diff -uprk.orig bash-2.05b.orig/execute_cmd.c bash-2.05b/execute_cmd.c --- bash-2.05b.orig/execute_cmd.c 2002-03-18 21:24:22 +0300 +++ bash-2.05b/execute_cmd.c 2002-09-16 03:17:09 +0400 @@ -2295,8 +2295,8 @@ execute_cond_node (cond) } else if (cond->type == COND_BINARY) { - patmatch = ((cond->op->word[1] == '=') && (cond->op->word[2] == '\0') && - (cond->op->word[0] == '!' || cond->op->word[0] == '=') || + patmatch = (((cond->op->word[1] == '=') && (cond->op->word[2] == '\0') && + (cond->op->word[0] == '!' || cond->op->word[0] == '=')) || (cond->op->word[0] == '=' && cond->op->word[1] == '\0')); arg1 = cond_expand_word (cond->left->op, 0); @@ -3030,6 +3030,7 @@ execute_subshell_builtin_or_function (wo { /* Give builtins a place to jump back to on failure, so we don't go back up to main(). */ + /* XXX: non-atomic update of top_level, do we allow interrupts here? */ result = setjmp (top_level); if (result == EXITPROG) diff -uprk.orig bash-2.05b.orig/expr.c bash-2.05b/expr.c --- bash-2.05b.orig/expr.c 2002-06-04 18:50:53 +0400 +++ bash-2.05b/expr.c 2002-09-16 03:17:09 +0400 @@ -391,11 +391,8 @@ expassign () if (lasttok != STR) evalerror ("attempted assignment to non-variable"); - if (special) - { - op = assigntok; /* a OP= b */ - lvalue = value; - } + op = assigntok; /* a OP= b */ + lvalue = value; lhs = savestring (tokstr); readtok (); diff -uprk.orig bash-2.05b.orig/findcmd.c bash-2.05b/findcmd.c --- bash-2.05b.orig/findcmd.c 2002-03-19 18:19:05 +0300 +++ bash-2.05b/findcmd.c 2002-09-16 03:17:09 +0400 @@ -205,7 +205,7 @@ _find_user_command_internal (name, flags /* Search for the value of PATH in both the temporary environments and in the regular list of variables. */ - if (var = find_variable_internal ("PATH", 1)) /* XXX could be array? */ + if ((var = find_variable_internal ("PATH", 1))) /* XXX could be array? */ path_list = value_cell (var); else path_list = (char *)NULL; @@ -362,6 +362,7 @@ user_command_matches (name, flags, state match_list[0] = find_absolute_program (name, flags); match_list[1] = (char *)NULL; path_list = (char *)NULL; + name_len = 0; /* never used */ } else { diff -uprk.orig bash-2.05b.orig/general.c bash-2.05b/general.c --- bash-2.05b.orig/general.c 2002-06-13 00:57:55 +0400 +++ bash-2.05b/general.c 2002-09-16 03:17:09 +0400 @@ -250,7 +250,7 @@ assignment (string) if (legal_variable_starter (c) == 0) return (0); - while (c = string[indx]) + while ((c = string[indx])) { /* The following is safe. Note that '=' at the start of a word is not an assignment statement. */ diff -uprk.orig bash-2.05b.orig/hashlib.c bash-2.05b/hashlib.c --- bash-2.05b.orig/hashlib.c 2002-03-18 18:30:23 +0300 +++ bash-2.05b/hashlib.c 2002-09-16 03:17:09 +0400 @@ -81,6 +81,7 @@ copy_bucket_array (ba, cpdata) if (ba == 0) return ((BUCKET_CONTENTS *)0); + new_bucket = NULL; for (n = (BUCKET_CONTENTS *)0, e = ba; e; e = e->next) { if (n == 0) diff -uprk.orig bash-2.05b.orig/jobs.c bash-2.05b/jobs.c --- bash-2.05b.orig/jobs.c 2002-05-09 19:56:20 +0400 +++ bash-2.05b/jobs.c 2002-09-16 03:17:09 +0400 @@ -707,7 +707,7 @@ nohup_job (job_index) if (job_slots == 0) return; - if (temp = jobs[job_index]) + if ((temp = jobs[job_index])) temp->flags |= J_NOHUP; } diff -uprk.orig bash-2.05b.orig/lib/glob/glob.c bash-2.05b/lib/glob/glob.c --- bash-2.05b.orig/lib/glob/glob.c 2002-04-11 17:22:28 +0400 +++ bash-2.05b/lib/glob/glob.c 2002-09-16 03:17:09 +0400 @@ -365,6 +365,7 @@ glob_vector (pat, dir, flags) lastlink = 0; count = lose = skip = 0; + name_vector = NULL; /* If PAT is empty, skip the loop, but return one (empty) filename. */ if (pat == 0 || *pat == '\0') diff -uprk.orig bash-2.05b.orig/lib/glob/smatch.c bash-2.05b/lib/glob/smatch.c --- bash-2.05b.orig/lib/glob/smatch.c 2002-04-03 17:39:52 +0400 +++ bash-2.05b/lib/glob/smatch.c 2002-09-16 03:17:09 +0400 @@ -245,7 +245,6 @@ rangecmp_wc (c1, c2) { static wchar_t s1[2] = { L' ', L'\0' }; static wchar_t s2[2] = { L' ', L'\0' }; - int ret; if (c1 == c2) return 0; diff -uprk.orig bash-2.05b.orig/lib/glob/sm_loop.c bash-2.05b/lib/glob/sm_loop.c --- bash-2.05b.orig/lib/glob/sm_loop.c 2002-04-03 18:35:09 +0400 +++ bash-2.05b/lib/glob/sm_loop.c 2002-09-16 03:17:09 +0400 @@ -288,7 +288,7 @@ BRACKMATCH (p, test, flags) circumflex (`^') in its role in a `nonmatching list'. A bracket expression starting with an unquoted circumflex character produces unspecified results. This implementation treats the two identically. */ - if (not = (*p == L('!') || *p == L('^'))) + if ((not = (*p == L('!') || *p == L('^')))) ++p; c = *p++; @@ -516,7 +516,7 @@ PATSCAN (string, end, delim) cchar = 0; bfirst = NULL; - for (s = string; c = *s; s++) + for (s = string; (c = *s); s++) { if (s >= end) return (s); @@ -698,7 +698,7 @@ fprintf(stderr, "extmatch: p = %s; pe = { pnext = PATSCAN (psub, pe, L('|')); /* If one of the patterns matches, just bail immediately. */ - if (m1 = (GMATCH (s, srest, psub, pnext - 1, flags) == 0)) + if ((m1 = (GMATCH (s, srest, psub, pnext - 1, flags) == 0))) break; if (pnext == prest) break; diff -uprk.orig bash-2.05b.orig/lib/malloc/malloc.c bash-2.05b/lib/malloc/malloc.c --- bash-2.05b.orig/lib/malloc/malloc.c 2002-06-21 23:16:49 +0400 +++ bash-2.05b/lib/malloc/malloc.c 2002-09-16 03:17:09 +0400 @@ -595,11 +595,13 @@ morecore_done: unblock_signals (&set, &oset); } +#ifdef INCLUDE_UNUSED static void malloc_debug_dummy () { write (1, "malloc_debug_dummy\n", 19); } +#endif #define PREPOP_BIN 2 #define PREPOP_SIZE 32 @@ -788,7 +790,9 @@ internal_free (mem, file, line, flags) register char *ap, *z; register int nunits; register unsigned int nbytes; +#if defined (MALLOC_TRACE) || defined (MALLOC_REGISTER) int ubytes; /* caller-requested size */ +#endif mguard_t mg; if ((ap = (char *)mem) == 0) @@ -901,6 +905,8 @@ free_return: if (_malloc_nwatch > 0) _malloc_ckwatch (mem, file, line, W_FREE, ubytes); #endif + + return; } static PTR_T diff -uprk.orig bash-2.05b.orig/lib/malloc/watch.c bash-2.05b/lib/malloc/watch.c --- bash-2.05b.orig/lib/malloc/watch.c 2002-05-24 19:32:53 +0400 +++ bash-2.05b/lib/malloc/watch.c 2002-09-16 03:17:09 +0400 @@ -83,7 +83,9 @@ PTR_T malloc_watch (addr) PTR_T addr; { +#ifdef MALLOC_WATCH register int i; +#endif /* MALLOC_WATCH */ PTR_T ret; if (addr == 0) @@ -107,7 +109,7 @@ malloc_watch (addr) } _malloc_watch_list[_malloc_nwatch++] = addr; } -#endif +#endif /* MALLOC_WATCH */ return ret; } diff -uprk.orig bash-2.05b.orig/lib/sh/makepath.c bash-2.05b/lib/sh/makepath.c --- bash-2.05b.orig/lib/sh/makepath.c 2001-11-24 22:27:19 +0300 +++ bash-2.05b/lib/sh/makepath.c 2002-09-16 03:17:09 +0400 @@ -110,7 +110,7 @@ sh_makepath (path, dir, flags) if (s[-1] != '/') *r++ = '/'; s = xdir; - while (*r++ = *s++) + while ((*r++ = *s++)) ; if (xpath != path) free (xpath); diff -uprk.orig bash-2.05b.orig/lib/sh/netopen.c bash-2.05b/lib/sh/netopen.c --- bash-2.05b.orig/lib/sh/netopen.c 2002-02-18 16:56:03 +0300 +++ bash-2.05b/lib/sh/netopen.c 2002-09-16 03:17:09 +0400 @@ -31,7 +31,8 @@ # include #endif -#include +#include +#include #include #if defined (HAVE_SYS_SOCKET_H) @@ -55,6 +56,8 @@ #include #include +#include "general.h" +#include "error.h" #ifndef errno extern int errno; @@ -201,7 +204,7 @@ _netopen6 (host, serv, typ) char *host, *serv; int typ; { - int s, e; + int s = -1; struct addrinfo hints, *res, *res0; int gerr; @@ -237,6 +240,7 @@ _netopen6 (host, serv, typ) } if (connect (s, res->ai_addr, res->ai_addrlen) < 0) { + int e; if (res->ai_next) { close (s); @@ -327,6 +331,8 @@ udpopen (host, serv) #else /* !HAVE_NETWORK */ +#include "error.h" + int netopen (path) char *path; diff -uprk.orig bash-2.05b.orig/lib/sh/pathcanon.c bash-2.05b/lib/sh/pathcanon.c --- bash-2.05b.orig/lib/sh/pathcanon.c 2001-11-21 20:06:14 +0300 +++ bash-2.05b/lib/sh/pathcanon.c 2002-09-16 03:17:09 +0400 @@ -107,7 +107,8 @@ sh_canonpath (path, flags) /* POSIX.2 says to leave a leading `//' alone. On cygwin, we skip over any leading `x:' (dos drive name). */ - if (rooted = ROOTEDPATH(path)) + double_slash_path = 0; + if ((rooted = ROOTEDPATH(path))) { stub_char = DIRSEP; #if defined (__CYGWIN__) diff -uprk.orig bash-2.05b.orig/lib/sh/shquote.c bash-2.05b/lib/sh/shquote.c --- bash-2.05b.orig/lib/sh/shquote.c 2002-05-02 21:38:23 +0400 +++ bash-2.05b/lib/sh/shquote.c 2002-09-16 03:17:09 +0400 @@ -26,6 +26,7 @@ #endif #include +#include #include "syntax.h" #include diff -uprk.orig bash-2.05b.orig/lib/sh/spell.c bash-2.05b/lib/sh/spell.c --- bash-2.05b.orig/lib/sh/spell.c 2001-11-27 20:34:15 +0300 +++ bash-2.05b/lib/sh/spell.c 2002-09-16 03:17:09 +0400 @@ -95,7 +95,7 @@ spname(oldname, newname) /* * Add to end of newname */ - for (p = best; *np = *p++; np++) + for (p = best; (*np = *p++); np++) ; } } diff -uprk.orig bash-2.05b.orig/lib/sh/stringlist.c bash-2.05b/lib/sh/stringlist.c --- bash-2.05b.orig/lib/sh/stringlist.c 2002-03-25 21:03:32 +0300 +++ bash-2.05b/lib/sh/stringlist.c 2002-09-16 03:17:09 +0400 @@ -141,6 +141,7 @@ strlist_copy (sl) return new; } +#ifdef INCLUDE_UNUSED /* Return a new STRINGLIST with everything from M1 and M2. */ STRINGLIST * @@ -162,6 +163,7 @@ strlist_merge (m1, m2) sl->list[n] = (char *)NULL; return (sl); } +#endif /* Make STRINGLIST M1 contain everything in M1 and M2. */ STRINGLIST * diff -uprk.orig bash-2.05b.orig/lib/sh/strtrans.c bash-2.05b/lib/sh/strtrans.c --- bash-2.05b.orig/lib/sh/strtrans.c 2002-05-13 23:32:27 +0400 +++ bash-2.05b/lib/sh/strtrans.c 2002-09-16 03:17:09 +0400 @@ -145,7 +145,7 @@ ansic_quote (str, flags, rlen) int flags, *rlen; { char *r, *ret, *s; - int l, rsize, t; + int l, rsize; unsigned char c; if (str == 0 || *str == 0) @@ -216,7 +216,7 @@ ansic_shouldquote (string) if (string == 0) return 0; - for (s = string; c = *s; s++) + for (s = string; (c = *s); s++) if (ISPRINT (c) == 0) return 1; diff -uprk.orig bash-2.05b.orig/lib/sh/zcatfd.c bash-2.05b/lib/sh/zcatfd.c --- bash-2.05b.orig/lib/sh/zcatfd.c 2002-04-04 22:33:31 +0400 +++ bash-2.05b/lib/sh/zcatfd.c 2002-09-16 03:17:09 +0400 @@ -40,7 +40,7 @@ extern int zwrite __P((int, char *, ssiz int zcatfd (fd, ofd, fn) int fd, ofd; - char *fn; + const char *fn; { ssize_t nr; int rval; diff -uprk.orig bash-2.05b.orig/lib/tilde/tilde.c bash-2.05b/lib/tilde/tilde.c --- bash-2.05b.orig/lib/tilde/tilde.c 2002-03-12 19:29:36 +0300 +++ bash-2.05b/lib/tilde/tilde.c 2002-09-16 03:17:09 +0400 @@ -190,7 +190,7 @@ tilde_expand (string) int result_size, result_index; result_index = result_size = 0; - if (result = strchr (string, '~')) + if ((result = strchr (string, '~'))) result = (char *)xmalloc (result_size = (strlen (string) + 16)); else result = (char *)xmalloc (result_size = (strlen (string) + 1)); diff -uprk.orig bash-2.05b.orig/mailcheck.c bash-2.05b/mailcheck.c --- bash-2.05b.orig/mailcheck.c 2002-01-10 22:23:15 +0300 +++ bash-2.05b/mailcheck.c 2002-09-16 03:17:09 +0400 @@ -326,7 +326,7 @@ remember_mail_dates () return; } - while (mailfile = extract_colon_unit (mailpaths, &i)) + while ((mailfile = extract_colon_unit (mailpaths, &i))) { mp = parse_mailpath_spec (mailfile); if (mp && *mp) @@ -400,7 +400,7 @@ check_mail () #undef atime #undef mtime - if (temp = expand_string_to_string (message, Q_DOUBLE_QUOTES)) + if ((temp = expand_string_to_string (message, Q_DOUBLE_QUOTES))) { puts (temp); free (temp); diff -uprk.orig bash-2.05b.orig/make_cmd.c bash-2.05b/make_cmd.c --- bash-2.05b.orig/make_cmd.c 2002-05-06 21:37:02 +0400 +++ bash-2.05b/make_cmd.c 2002-09-16 03:17:09 +0400 @@ -580,7 +580,7 @@ make_here_document (temp) be read verbatim from the input. If it was not quoted, we need to perform backslash-quoted newline removal. */ delim_unquoted = (temp->redirectee.filename->flags & W_QUOTED) == 0; - while (full_line = read_secondary_line (delim_unquoted)) + while ((full_line = read_secondary_line (delim_unquoted))) { register char *line; int len; diff -uprk.orig bash-2.05b.orig/parse.y bash-2.05b/parse.y --- bash-2.05b.orig/parse.y 2002-05-21 19:57:30 +0400 +++ bash-2.05b/parse.y 2002-09-16 03:21:47 +0400 @@ -162,7 +162,9 @@ static char *read_a_line __P((int)); static int reserved_word_acceptable __P((int)); static int yylex __P((void)); static int alias_expand_token __P((char *)); +#if defined (COMMAND_TIMING) static int time_command_acceptable __P((void)); +#endif static int special_case_tokens __P((char *)); static int read_token __P((int)); static char *parse_matched_pair __P((int, int, int, int *, int)); @@ -187,7 +189,9 @@ static int token_is_assignment __P((char static int token_is_ident __P((char *, int)); #endif static int read_token_word __P((int)); +#ifdef INCLUDE_UNUSED static void discard_parser_constructs __P((int)); +#endif static char *error_token_from_token __P((int)); static char *error_token_from_text __P((void)); @@ -2187,10 +2191,10 @@ alias_expand_token (tokstr) } #endif /* ALIAS */ +#if defined (COMMAND_TIMING) static int time_command_acceptable () { -#if defined (COMMAND_TIMING) switch (last_read_token) { case 0: @@ -2208,10 +2212,8 @@ time_command_acceptable () default: return 0; } -#else - return 0; -#endif /* COMMAND_TIMING */ } +#endif /* COMMAND_TIMING */ /* Handle special cases of token recognition: IN is recognized if the last token was WORD and the token @@ -2721,6 +2723,7 @@ parse_matched_pair (qc, open, close, len { if (open == ch) /* undo previous increment */ count--; + nestret = '\0'; /* never used */ if (ch == '(') /* ) */ nestret = parse_matched_pair (0, '(', ')', &nestlen, 0); else if (ch == '{') /* } */ @@ -2864,13 +2867,13 @@ parse_arith_cmd (ep) static void cond_error () { - char *etext; - if (EOF_Reached && cond_token != COND_ERROR) /* [[ */ parser_error (cond_lineno, "unexpected EOF while looking for `]]'"); else if (cond_token != COND_ERROR) { - if (etext = error_token_from_token (cond_token)) + char *etext = error_token_from_token (cond_token); + + if (etext) { parser_error (cond_lineno, "syntax error in conditional expression: unexpected token `%s'", etext); free (etext); @@ -2952,7 +2955,7 @@ cond_term () { if (term) dispose_cond_node (term); /* ( */ - if (etext = error_token_from_token (cond_token)) + if ((etext = error_token_from_token (cond_token))) { parser_error (lineno, "unexpected token `%s', expected `)'", etext); free (etext); @@ -2984,7 +2987,7 @@ cond_term () else { dispose_word (op); - if (etext = error_token_from_token (tok)) + if ((etext = error_token_from_token (tok))) { parser_error (line_number, "unexpected argument `%s' to conditional unary operator", etext); free (etext); @@ -3021,7 +3024,7 @@ cond_term () } else { - if (etext = error_token_from_token (tok)) + if ((etext = error_token_from_token (tok))) { parser_error (line_number, "unexpected token `%s', conditional binary operator expected", etext); free (etext); @@ -3041,7 +3044,7 @@ cond_term () } else { - if (etext = error_token_from_token (tok)) + if ((etext = error_token_from_token (tok))) { parser_error (line_number, "unexpected argument `%s' to conditional binary operator", etext); free (etext); @@ -3059,7 +3062,7 @@ cond_term () { if (tok < 256) parser_error (line_number, "unexpected token `%c' in conditional command", tok); - else if (etext = error_token_from_token (tok)) + else if ((etext = error_token_from_token (tok))) { parser_error (line_number, "unexpected token `%s' in conditional command", etext); free (etext); @@ -3774,7 +3777,7 @@ decode_prompt_string (string) result[result_index = 0] = 0; temp = (char *)NULL; - while (c = *string++) + while ((c = *string++)) { if (posixly_correct && c == '!') { @@ -4124,10 +4127,10 @@ error_token_from_token (token) { char *t; - if (t = find_token_in_alist (token, word_token_alist, 0)) + if ((t = find_token_in_alist (token, word_token_alist, 0))) return t; - if (t = find_token_in_alist (token, other_token_alist, 0)) + if ((t = find_token_in_alist (token, other_token_alist, 0))) return t; t = (char *)NULL; @@ -4279,6 +4282,7 @@ report_syntax_error (message) last_command_exit_value = EX_USAGE; } +#ifdef INCLUDE_UNUSED /* ??? Needed function. ??? We have to be able to discard the constructs created during parsing. In the case of error, we want to return allocated objects to the memory pool. In the case of no error, we want @@ -4289,6 +4293,7 @@ discard_parser_constructs (error_p) int error_p; { } +#endif /************************************************ * * diff -uprk.orig bash-2.05b.orig/pathexp.c bash-2.05b/pathexp.c --- bash-2.05b.orig/pathexp.c 2002-05-06 21:43:05 +0400 +++ bash-2.05b/pathexp.c 2002-09-16 03:17:09 +0400 @@ -67,7 +67,7 @@ unquoted_glob_pattern_p (string) open = 0; send = string + strlen (string); - while (c = *string++) + while ((c = *string++)) { switch (c) { @@ -419,7 +419,7 @@ setup_ignore_patterns (ivp) numitems = maxitems = ptr = 0; - while (colon_bit = extract_colon_unit (this_ignoreval, &ptr)) + while ((colon_bit = extract_colon_unit (this_ignoreval, &ptr))) { if (numitems + 1 >= maxitems) { diff -uprk.orig bash-2.05b.orig/pcomplete.c bash-2.05b/pcomplete.c --- bash-2.05b.orig/pcomplete.c 2002-04-10 18:10:03 +0400 +++ bash-2.05b/pcomplete.c 2002-09-16 03:17:09 +0400 @@ -509,6 +509,7 @@ it_init_joblist (itp, jstate) char *s, *t; JOB_STATE js; + js = -1; if (jstate == 0) js = JRUNNING; else if (jstate == 1) diff -uprk.orig bash-2.05b.orig/print_cmd.c bash-2.05b/print_cmd.c --- bash-2.05b.orig/print_cmd.c 2002-03-12 22:39:30 +0300 +++ bash-2.05b/print_cmd.c 2002-09-16 03:17:09 +0400 @@ -143,7 +143,7 @@ make_command_string_internal (command) COMMAND *command; { if (command == 0) - cprintf (""); + cprintf ("%s", ""); else { if (skip_this_indent) diff -uprk.orig bash-2.05b.orig/redir.c bash-2.05b/redir.c --- bash-2.05b.orig/redir.c 2002-03-12 23:27:38 +0300 +++ bash-2.05b/redir.c 2002-09-16 03:17:09 +0400 @@ -116,6 +116,7 @@ redirection_error (temp, error) #endif else if (expandable_redirection_filename (temp)) { + oflags = 0; /* never used */ if (posixly_correct && interactive_shell == 0) { oflags = temp->redirectee.filename->flags; @@ -656,6 +657,8 @@ do_redirection_internal (redirect, for_r case r_move_output_word: new_redirect = make_redirection (redirector, r_move_output, rd); break; + default: + break; } } else if (ri == r_duplicating_output_word && redirector == 1) @@ -710,6 +712,7 @@ do_redirection_internal (redirect, for_r case r_err_and_out: /* command &>filename */ case r_input_output: case r_output_force: + oflags = 0; /* never used */ if (posixly_correct && interactive_shell == 0) { oflags = redirectee->flags; @@ -1027,6 +1030,8 @@ stdin_redirection (ri, redirector) case r_output_force: case r_duplicating_output_word: return (0); + default: + break; } return (0); } diff -uprk.orig bash-2.05b.orig/shell.c bash-2.05b/shell.c --- bash-2.05b.orig/shell.c 2002-07-01 19:27:11 +0400 +++ bash-2.05b/shell.c 2002-09-16 03:17:09 +0400 @@ -531,6 +531,7 @@ main (argc, argv, env) /* Give this shell a place to longjmp to before executing the startup files. This allows users to press C-c to abort the lengthy startup. */ + /* XXX: non-atomic update of top_level with nothing preventing its use */ code = setjmp (top_level); if (code) { @@ -762,7 +763,7 @@ parse_shell_options (argv, arg_start, ar i = 1; on_or_off = arg_string[0]; - while (arg_character = arg_string[i++]) + while ((arg_character = arg_string[i++])) { switch (arg_character) { @@ -1135,6 +1136,8 @@ run_wordexp (words) int code, nw, nb; WORD_LIST *wl, *result; + /* XXX: non-atomic update of top_level with nothing preventing its use */ + /* XXX: doesn't restore top_level on function return (but will exit soon) */ code = setjmp (top_level); if (code != NOT_JUMPED) @@ -1205,6 +1208,8 @@ run_one_command (command) { int code; + /* XXX: non-atomic update of top_level with nothing preventing its use */ + /* XXX: doesn't restore top_level on function return (but will exit soon) */ code = setjmp (top_level); if (code != NOT_JUMPED) diff -uprk.orig bash-2.05b.orig/sig.c bash-2.05b/sig.c --- bash-2.05b.orig/sig.c 2002-07-11 00:07:53 +0400 +++ bash-2.05b/sig.c 2002-09-16 03:17:09 +0400 @@ -445,6 +445,8 @@ sigint_sighandler (sig) if (interrupt_immediately) { interrupt_immediately = 0; + /* XXX: may interrupt non-reentrant library functions and cause + * re-entry with invalid (internal) state. */ throw_to_top_level (); } diff -uprk.orig bash-2.05b.orig/subst.c bash-2.05b/subst.c --- bash-2.05b.orig/subst.c 2002-06-24 15:59:45 +0400 +++ bash-2.05b/subst.c 2002-09-16 03:17:09 +0400 @@ -164,8 +164,10 @@ WORD_LIST *subst_assign_varlist = (WORD_ without any leading variable assignments. */ static WORD_LIST *garglist = (WORD_LIST *)NULL; +#ifdef INCLUDE_UNUSED static char *quoted_substring __P((char *, int, int)); static int quoted_strlen __P((char *)); +#endif static char *quoted_strchr __P((char *, int, int)); static char *expand_string_if_necessary __P((char *, int, EXPFUNC *)); @@ -204,7 +206,9 @@ static int match_pattern_char __P((char static int match_pattern __P((char *, char *, int, char **, char **)); static int getpatspec __P((int, char *)); static char *getpattern __P((char *, int, int)); +#ifdef INCLUDE_UNUSED static char *variable_remove_pattern __P((char *, char *, int, int)); +#endif static char *list_remove_pattern __P((WORD_LIST *, char *, int, int, int)); static char *parameter_list_remove_pattern __P((int, char *, int, int)); #ifdef ARRAY_VARS @@ -366,7 +370,7 @@ unquoted_member (character, string) slen = strlen (string); sindex = 0; - while (c = string[sindex]) + while ((c = string[sindex])) { if (c == character) return (1); @@ -409,7 +413,7 @@ unquoted_substring (substr, string) slen = strlen (string); sublen = strlen (substr); - for (sindex = 0; c = string[sindex]; ) + for (sindex = 0; (c = string[sindex]); ) { if (STREQN (string + sindex, substr, sublen)) return (1); @@ -516,7 +520,7 @@ string_extract (string, sindex, charlist slen = strlen (string + *sindex) + *sindex; i = *sindex; - while (c = string[i]) + while ((c = string[i])) { if (c == '\\') { @@ -575,7 +579,7 @@ string_extract_double_quoted (string, si j = 0; i = *sindex; - while (c = string[i]) + while ((c = string[i])) { /* Process a character that was quoted by a backslash. */ if (pass_next) @@ -704,7 +708,7 @@ skip_double_quoted (string, slen, sind) pass_next = backquote = 0; i = sind; - while (c = string[i]) + while ((c = string[i])) { if (pass_next) { @@ -822,7 +826,7 @@ string_extract_verbatim (string, sindex, return temp; } - for (i = *sindex; c = string[i]; i++) + for (i = *sindex; (c = string[i]); i++) { if (c == CTLESC) { @@ -1034,7 +1038,7 @@ extract_dollar_brace_string (string, sin slen = strlen (string + *sindex) + *sindex; i = *sindex; - while (c = string[i]) + while ((c = string[i])) { if (pass_character) { @@ -1295,7 +1299,7 @@ skip_to_delim (string, start, delims) no_longjmp_on_fatal_error = 1; i = start; pass_next = backq = 0; - while (c = string[i]) + while ((c = string[i])) { if (pass_next) { @@ -1973,7 +1977,7 @@ do_assignment_internal (string, expand) #define ASSIGN_RETURN(r) do { FREE (value); free (name); return (r); } while (0) #if defined (ARRAY_VARS) - if (t = xstrchr (name, '[')) /*]*/ + if ((t = xstrchr (name, '['))) /*]*/ { if (assign_list) { @@ -2891,7 +2895,7 @@ match_pattern_char (pat, string) if (*string == 0) return (0); - switch (c = *pat++) + switch ((c = *pat++)) { default: return (*string == c); @@ -3011,7 +3015,6 @@ getpattern (value, quoted, expandpat) { char *pat, *tword; WORD_LIST *l; - int i; tword = xstrchr (value, '~') ? bash_tilde_expand (value, 0) : savestring (value); @@ -3023,7 +3026,7 @@ getpattern (value, quoted, expandpat) #if 0 if (expandpat && (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && *tword) { - i = 0; + int i = 0; pat = string_extract_double_quoted (tword, &i, 1); free (tword); tword = pat; @@ -3626,6 +3629,7 @@ read_comsub (fd, quoted) istring = (char *)NULL; istring_index = istring_size = bufn = 0; + bufp = buf; /* redundant */ #ifdef __CYGWIN__ setmode (fd, O_TEXT); /* we don't want CR/LF, we want Unix-style */ @@ -4007,7 +4011,7 @@ parameter_brace_expand_word (name, var_i temp = quote_escapes (temp); } #endif - else if (var = find_variable (name)) + else if ((var = find_variable (name))) { if (var_isset (var) && invisible_p (var) == 0) { @@ -4185,6 +4189,7 @@ parameter_brace_expand_length (name) SHELL_VAR *var; #endif + t = NULL; if (name[1] == '\0') /* ${#} */ number = number_of_args (); else if ((name[1] == '@' || name[1] == '*') && name[2] == '\0') /* ${#@}, ${#*} */ @@ -4489,6 +4494,7 @@ parameter_brace_substring (varname, valu if (r <= 0) return ((r == 0) ? &expand_param_error : (char *)NULL); + temp = NULL; switch (vtype) { case VT_VARIABLE: @@ -4576,7 +4582,7 @@ pat_subst (string, pat, rep, mflags) ret = (char *)xmalloc (rsize = 64); ret[0] = '\0'; - for (replen = STRLEN (rep), rptr = 0, str = string;;) + for (replen = STRLEN (rep), rptr = 0, (str = string);;) { if (match_pattern (str, pat, mtype, &s, &e) == 0) break; @@ -4624,7 +4630,7 @@ pos_params_pat_subst (string, pat, rep, { WORD_LIST *save, *params; WORD_DESC *w; - char *ret, *tt; + char *ret; save = params = list_rest_of_args (); if (save == 0) @@ -4681,7 +4687,7 @@ parameter_brace_patsub (varname, value, if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) mflags |= MATCH_QUOTED; - if (rep = quoted_strchr (lpatsub, '/', ST_BACKSL)) + if ((rep = quoted_strchr (lpatsub, '/', ST_BACKSL))) *rep++ = '\0'; else rep = (char *)NULL; @@ -4727,6 +4733,7 @@ parameter_brace_patsub (varname, value, other cases if QUOTED == 0, since the posparams and arrays indexed by * or @ do special things when QUOTED != 0. */ + temp = 0; switch (vtype) { case VT_VARIABLE: @@ -4828,7 +4835,7 @@ parameter_brace_expand (string, indexp, /* Find out what character ended the variable name. Then do the appropriate thing. */ - if (c = string[sindex]) + if ((c = string[sindex])) sindex++; /* If c is followed by one of the valid parameter expansion @@ -4838,7 +4845,7 @@ parameter_brace_expand (string, indexp, if (c == ':' && VALID_PARAM_EXPAND_CHAR (string[sindex])) { check_nullness++; - if (c = string[sindex]) + if ((c = string[sindex])) sindex++; } else if (c == ':' && string[sindex] != RBRACE) @@ -6068,7 +6075,7 @@ string_quote_removal (string, quoted) r = result_string = (char *)xmalloc (slen + 1); - for (dquote = sindex = 0; c = string[sindex];) + for (dquote = sindex = 0; (c = string[sindex]);) { switch (c) { @@ -6498,7 +6505,7 @@ brace_expand_word_list (tlist, eflags) { expansions = brace_expand (tlist->word->word); - for (eindex = 0; temp_string = expansions[eindex]; eindex++) + for (eindex = 0; (temp_string = expansions[eindex]); eindex++) { w = make_word (temp_string); /* If brace expansion didn't change the word, preserve diff -uprk.orig bash-2.05b.orig/test.c bash-2.05b/test.c --- bash-2.05b.orig/test.c 2002-02-28 18:54:47 +0300 +++ bash-2.05b/test.c 2002-09-16 03:17:09 +0400 @@ -30,6 +30,8 @@ #include +#include "stdc.h" + #include "bashtypes.h" #if !defined (HAVE_LIMITS_H) @@ -134,7 +136,7 @@ static int filecomp __P((char *, char *, static int arithcomp __P((char *, char *, int, int)); static int patcomp __P((char *, char *, int)); -static void +static void __attribute__((__noreturn__)) test_syntax_error (format, arg) char *format, *arg; { @@ -749,6 +751,8 @@ test_binop (op) else return (0); } + + return 0; } /* Return non-zero if OP is one of the test command's unary operators. */ diff -uprk.orig bash-2.05b.orig/unwind_prot.c bash-2.05b/unwind_prot.c --- bash-2.05b.orig/unwind_prot.c 2002-02-28 22:34:05 +0300 +++ bash-2.05b/unwind_prot.c 2002-09-16 03:17:09 +0400 @@ -235,7 +235,7 @@ unwind_frame_discard_internal (tag, igno { UNWIND_ELT *elt; - while (elt = unwind_protect_list) + while ((elt = unwind_protect_list)) { unwind_protect_list = unwind_protect_list->head.next; if (elt->head.cleanup == 0 && (STREQ (elt->arg.v, tag))) @@ -264,7 +264,7 @@ unwind_frame_run_internal (tag, ignore) { UNWIND_ELT *elt; - while (elt = unwind_protect_list) + while ((elt = unwind_protect_list)) { unwind_protect_list = elt->head.next; diff -uprk.orig bash-2.05b.orig/variables.c bash-2.05b/variables.c --- bash-2.05b.orig/variables.c 2002-06-25 17:43:33 +0400 +++ bash-2.05b/variables.c 2002-09-16 03:17:09 +0400 @@ -239,7 +239,7 @@ initialize_shell_variables (env, privmod if (shell_functions == 0) shell_functions = hash_create (0); - for (string_index = 0; string = env[string_index++]; ) + for (string_index = 0; (string = env[string_index++]); ) { char_index = 0; name = string; @@ -276,7 +276,7 @@ initialize_shell_variables (env, privmod if (name[char_index - 1] == ')' && name[char_index - 2] == '(') name[char_index - 2] = '\0'; - if (temp_var = find_function (name)) + if ((temp_var = find_function (name))) { VSETATTR (temp_var, (att_exported|att_imported)); array_needs_making = 1; @@ -1320,7 +1320,7 @@ var_lookup (name, vcontext) v = (SHELL_VAR *)NULL; for (vc = vcontext; vc; vc = vc->down) - if (v = hash_lookup (name, vc->table)) + if ((v = hash_lookup (name, vc->table))) break; return v; @@ -1442,7 +1442,7 @@ make_local_variable (name) SHELL_VAR *new_var, *old_var; VAR_CONTEXT *vc; int was_tmpvar; - char *tmp_value; + char *tmp_value = 0; /* local foo; local foo; is a no-op. */ old_var = find_variable (name); @@ -1788,7 +1788,7 @@ bind_int_variable (lhs, rhs) isint = isarr = 0; #if defined (ARRAY_VARS) - if (t = xstrchr (lhs, '[')) /*]*/ + if ((t = xstrchr (lhs, '['))) /*]*/ { isarr = 1; v = array_variable_part (lhs, (char **)0, (int *)0); @@ -2077,7 +2077,7 @@ makunbound (name, vc) char *t; for (elt = (BUCKET_CONTENTS *)NULL, v = vc; v; v = v->down) - if (elt = hash_remove (name, v->table, 0)) + if ((elt = hash_remove (name, v->table, 0))) break; if (elt == 0) @@ -2750,7 +2750,7 @@ make_env_array_from_var_list (vars) #define USE_EXPORTSTR (value == var->exportstr) - for (i = 0, list_index = 0; var = vars[i]; i++) + for (i = 0, list_index = 0; (var = vars[i]); i++) { #if defined (__CYGWIN__) /* We don't use the exportstr stuff on Cygwin at all. */ @@ -3160,7 +3160,7 @@ pop_var_context () return; } - if (ret = vcxt->down) + if ((ret = vcxt->down)) { ret->up = (VAR_CONTEXT *)NULL; shell_variables = ret;