@@ -1,1393 +0,0 @@
1−--- bashline.c 2015-02-06 17:12:55.823275600 -0700
2−+++ bashline.c 2015-02-06 17:14:11.000103800 -0700
3−@@ -71,6 +71,16 @@
4− # include "pcomplete.h"
5− #endif
6−
7−+#if __CYGWIN__
8−+# ifdef __x86_64__
9−+# define IMP(x) __imp_##x
10−+# else
11−+# define IMP(x) _imp__##x
12−+# endif
13−+#else
14−+# define IMP(x) x
15−+#endif
16−+
17− /* These should agree with the defines for emacs_mode and vi_mode in
18− rldefs.h, even though that's not a public readline header file. */
19− #ifndef EMACS_EDITING_MODE
20−@@ -264,6 +274,11 @@ int no_empty_command_completion;
21− are the only possible matches, even if FIGNORE says to. */
22− int force_fignore = 1;
23−
24−+#if __CYGWIN__
25−+/* If set, shorten "foo.exe" to "foo" when they are the same file. */
26−+int completion_strip_exe;
27−+#endif /* __CYGWIN__ */
28−+
29− /* Perform spelling correction on directory names during word completion */
30− int dircomplete_spelling = 0;
31−
32−@@ -491,11 +506,12 @@ initialize_readline ()
33− kseq[0] = CTRL('J');
34− kseq[1] = '\0';
35− func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
36−- if (func == rl_vi_editing_mode)
37−+ extern rl_command_func_t *IMP(rl_vi_editing_mode);
38−+ if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
39− rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
40− kseq[0] = CTRL('M');
41− func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
42−- if (func == rl_vi_editing_mode)
43−+ if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
44− rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
45− #if defined (VI_MODE)
46− rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap);
47−@@ -514,7 +530,8 @@ initialize_readline ()
48− kseq[0] = '~';
49− kseq[1] = '\0';
50− func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
51−- if (func == 0 || func == rl_tilde_expand)
52−+ extern rl_command_func_t *IMP(rl_tilde_expand);
53−+ if (func == 0 || func == rl_tilde_expand || func == IMP(rl_tilde_expand))
54− rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap);
55−
56− rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
57−@@ -537,7 +554,8 @@ initialize_readline ()
58− kseq[0] = TAB;
59− kseq[1] = '\0';
60− func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
61−- if (func == 0 || func == rl_tab_insert)
62−+ extern rl_command_func_t *IMP(rl_tab_insert);
63−+ if (func == 0 || func == rl_tab_insert || func == IMP(rl_tab_insert))
64− rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
65−
66− /* Tell the completer that we want a crack first. */
67−@@ -2109,6 +2127,21 @@ globword:
68−
69− if (match && executable_completion ((searching_path ? val : cval), searching_path))
70− {
71−+#if __CYGWIN__
72−+ if (completion_strip_exe)
73−+ {
74−+ size_t val_len = strlen (val);
75−+ char *candidate;
76−+ if (val_len > 4 && !strcasecmp (&val[val_len - 4], ".exe")
77−+ && (candidate = strdup (val)))
78−+ {
79−+ candidate[val_len - 4] = '\0';
80−+ if (same_file (val, candidate, NULL, NULL))
81−+ temp[strlen (temp) - 4] = '\0';
82−+ free (candidate);
83−+ }
84−+ }
85−+#endif
86− if (cval != val)
87− free (cval);
88− free (val);
89−@@ -2844,6 +2877,17 @@ test_for_directory (name)
90− int r;
91−
92− fn = bash_tilde_expand (name, 0);
93−+#if __CYGWIN__
94−+ /* stat("//server") can only be successful as a directory, but takes
95−+ a several-second timeout to fail. It is much faster to assume
96−+ that //server is a valid name than it is to wait for the stat,
97−+ even though it gives false positives on bad names. */
98−+ if (fn[0] == '/' && fn[1] == '/' && ! strchr (&fn[2], '/'))
99−+ {
100−+ free (fn);
101−+ return 1;
102−+ }
103−+#endif /* __CYGWIN__ */
104− r = file_isdir (fn);
105− free (fn);
106−
107−--- builtins/evalstring.c 2015-02-06 17:12:55.682776800 -0700
108−+++ builtins/evalstring.c 2015-02-06 17:14:11.015662800 -0700
109−@@ -195,7 +195,7 @@ parse_and_execute (string, from_file, fl
110− int code, lreset;
111− volatile int should_jump_to_top_level, last_result;
112− COMMAND *volatile command;
113−- volatile sigset_t pe_sigmask;
114−+ sigset_t pe_sigmask;
115−
116− parse_prologue (string, flags, PE_TAG);
117−
118−@@ -451,7 +451,7 @@ parse_string (string, from_file, flags,
119− volatile int should_jump_to_top_level;
120− COMMAND *volatile command, *oglobal;
121− char *ostring;
122−- volatile sigset_t ps_sigmask;
123−+ sigset_t ps_sigmask;
124−
125− parse_prologue (string, flags, PS_TAG);
126−
127−--- builtins/set.def 2013-04-19 05:20:34.000000000 -0600
128−+++ builtins/set.def 2015-02-06 17:14:11.015662800 -0700
129−@@ -56,6 +56,13 @@ extern int dont_save_function_defs;
130− #if defined (READLINE)
131− extern int no_line_editing;
132− #endif /* READLINE */
133−+#if __CYGWIN__
134−+extern int igncr;
135−+static int set_minus_o_option_maybe (int, const char *, int);
136−+# define INTERACTIVE_ONLY ,1
137−+#else /* ! __CYGWIN__ */
138−+# define INTERACTIVE_ONLY
139−+#endif
140−
141− $BUILTIN set
142− $FUNCTION set_builtin
143−@@ -92,6 +99,9 @@ Options:
144− #if defined (HISTORY)
145− history enable command history
146− #endif
147−+#if __CYGWIN__
148−+ igncr on cygwin, ignore \r in line endings
149−+#endif
150− ignoreeof the shell will not exit upon reading EOF
151− interactive-comments
152− allow comments to appear in interactive commands
153−@@ -188,29 +198,41 @@ const struct {
154− int *variable;
155− setopt_set_func_t *set_func;
156− setopt_get_func_t *get_func;
157−+#if __CYGWIN__
158−+ /* Cygwin users have taken to exporting SHELLOPTS for the
159−+ cygwin-specific igncr. As a result, we need to make sure
160−+ SHELLOPTS parsing does not turn on interactive options when
161−+ exported from an interactive shell, but parsed in a
162−+ non-interactive setting, since some interactive options violate
163−+ POSIX /bin/sh rules. */
164−+ int interactive_only;
165−+#endif /* __CYGWIN__ */
166− } o_options[] = {
167− { "allexport", 'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
168− #if defined (BRACE_EXPANSION)
169− { "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
170− #endif
171− #if defined (READLINE)
172−- { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode },
173−+ { "emacs", '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY},
174− #endif
175− { "errexit", 'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
176− { "errtrace", 'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
177− { "functrace", 'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
178− { "hashall", 'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
179− #if defined (BANG_HISTORY)
180−- { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
181−+ { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY},
182− #endif /* BANG_HISTORY */
183− #if defined (HISTORY)
184−- { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL },
185−+ { "history", '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL INTERACTIVE_ONLY},
186−+#endif
187−+#if __CYGWIN__
188−+ { "igncr", '\0', &igncr, NULL, (setopt_get_func_t *)NULL },
189− #endif
190− { "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL },
191− { "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
192− { "keyword", 'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
193− #if defined (JOB_CONTROL)
194−- { "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
195−+ { "monitor", 'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY},
196− #endif
197− { "noclobber", 'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
198− { "noexec", 'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
199−@@ -229,7 +251,7 @@ const struct {
200− { "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
201− { "verbose", 'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
202− #if defined (READLINE)
203−- { "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode },
204−+ { "vi", '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY},
205− #endif
206− { "xtrace", 'x', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
207− {(char *)NULL, 0 , (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
208−@@ -416,6 +438,15 @@ int
209− set_minus_o_option (on_or_off, option_name)
210− int on_or_off;
211− char *option_name;
212−+#if __CYGWIN__
213−+{
214−+ /* See cygwin comments above. */
215−+ return set_minus_o_option_maybe (on_or_off, option_name, 0);
216−+}
217−+static int
218−+set_minus_o_option_maybe (int on_or_off, const char *option_name,
219−+ int avoid_interactive)
220−+#endif /* __CYGWIN__ */
221− {
222− register int i;
223−
224−@@ -423,6 +454,10 @@ set_minus_o_option (on_or_off, option_na
225− {
226− if (STREQ (option_name, o_options[i].name))
227− {
228−+#if __CYGWIN__
229−+ if (o_options[i].interactive_only && avoid_interactive)
230−+ return EXECUTION_SUCCESS;
231−+#endif /* __CYGWIN__ */
232− if (o_options[i].letter == 0)
233− {
234− SET_BINARY_O_OPTION_VALUE (i, on_or_off, option_name);
235−@@ -548,7 +583,11 @@ parse_shellopts (value)
236− vptr = 0;
237− while (vname = extract_colon_unit (value, &vptr))
238− {
239−+#if __CYGWIN__
240−+ set_minus_o_option_maybe (FLAG_ON, vname, !interactive_shell);
241−+#else /* !__CYGWIN__ */
242− set_minus_o_option (FLAG_ON, vname);
243−+#endif
244− free (vname);
245− }
246− }
247−--- builtins/shopt.def 2013-02-27 07:43:20.000000000 -0700
248−+++ builtins/shopt.def 2015-02-06 17:14:11.015662800 -0700
249−@@ -91,6 +91,11 @@ extern int glob_star;
250− extern int glob_asciirange;
251− extern int lastpipe_opt;
252−
253−+#if __CYGWIN__
254−+extern int completion_strip_exe;
255−+#endif
256−+
257−+
258− #if defined (EXTENDED_GLOB)
259− extern int extended_glob;
260− #endif
261−@@ -161,6 +166,9 @@ static struct {
262− { "compat40", &shopt_compat40, set_compatibility_level },
263− { "compat41", &shopt_compat41, set_compatibility_level },
264− { "compat42", &shopt_compat41, set_compatibility_level },
265−+#if __CYGWIN__
266−+ { "completion_strip_exe", &completion_strip_exe, NULL },
267−+#endif
268− #if defined (READLINE)
269− { "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL},
270− { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
271−--- config-top.h 2012-08-18 18:51:30.000000000 -0600
272−+++ config-top.h 2015-02-06 17:14:11.015662800 -0700
273−@@ -80,10 +80,10 @@
274− #define KSH_COMPATIBLE_SELECT
275−
276− /* System-wide .bashrc file for interactive shells. */
277−-/* #define SYS_BASHRC "/etc/bash.bashrc" */
278−+#define SYS_BASHRC "/etc/bash.bashrc"
279−
280− /* System-wide .bash_logout for login shells. */
281−-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
282−+#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
283−
284− /* Define this to make non-interactive shells begun with argv[0][0] == '-'
285− run the startup files when not in posix mode. */
286−@@ -93,7 +93,7 @@
287− sshd and source the .bashrc if so (like the rshd behavior). This checks
288− for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
289− which can be fooled under certain not-uncommon circumstances. */
290−-/* #define SSH_SOURCE_BASHRC */
291−+#define SSH_SOURCE_BASHRC
292−
293− /* Define if you want the case-capitalizing operators (~[~]) and the
294− `capcase' variable attribute (declare -c). */
295−--- doc/Makefile.in 2013-10-30 14:18:12.000000000 -0600
296−+++ doc/Makefile.in 2015-02-06 17:14:11.015662800 -0700
297−@@ -176,7 +176,7 @@ bashref.html: $(BASHREF_FILES) $(HSUSER)
298− $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi
299−
300− bash.info: bashref.info
301−- ${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \
302−+ ${SHELL} ${INFOPOST} < bashref.info > $@ ; \
303−
304− bash.txt: bash.1
305− bash.ps: bash.1
306−@@ -237,9 +237,9 @@ install: info installdirs bash.info
307− -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
308− -$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
309− # uncomment the next lines to install the builtins man page
310−-# sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
311−-# -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
312−-# -$(RM) $${TMPDIR:-/var/tmp}/builtins.1
313−+ sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
314−+ -$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
315−+ -$(RM) $${TMPDIR:-/var/tmp}/builtins.1
316− -if test -f bash.info; then d=.; else d=$(srcdir); fi; \
317− $(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info
318− # run install-info if it is present to update the info directory
319−--- doc/bash.1 2014-02-06 07:03:52.000000000 -0700
320−+++ doc/bash.1 2015-02-06 17:14:11.015662800 -0700
321−@@ -1658,6 +1658,14 @@ subsequently reset.
322− Expands to the effective user ID of the current user, initialized at
323− shell startup. This variable is readonly.
324− .TP
325−+.B EXECIGNORE
326−+A colon-separated list of extended glob (see \fBPattern Matching\fP)
327−+patterns. Files with full paths matching one of these patterns are
328−+not considered executable for the purposes of completion and PATH
329−+searching, but the \fB[\fP, \fB[[\fP, and \fBtest\fP builtins are not
330−+affected. Use this variable to deal with systems that set the
331−+executable bit on files that are not actually executable.
332−+.TP
333− .B FUNCNAME
334− An array variable containing the names of all shell functions
335− currently in the execution call stack.
336−@@ -3308,6 +3316,10 @@ the character
337− .B ``.''
338− at the start of a name or immediately following a slash
339− must be matched explicitly, unless the shell option
340−+.B completion_strip_exe
341−+If set, whenever bash sees `foo.exe' during completion, it checks if
342−+`foo' is the same file and strips the suffix.
343−+.TP 8
344− .B dotglob
345− is set.
346− When matching a pathname, the slash character must always be
347−--- doc/bashref.texi 2014-02-22 11:20:36.000000000 -0700
348−+++ doc/bashref.texi 2015-02-06 17:14:11.015662800 -0700
349−@@ -4992,6 +4992,10 @@ filenames.
350− This variable is set by default, which is the default Bash behavior in
351− versions through 4.2.
352−
353−+@item completion_strip_exe
354−+If set, whenever bash sees `foo.exe' during completion, it checks if
355−+`foo' is the same file and strips the suffix.
356−+
357− @item direxpand
358− If set, Bash
359− replaces directory names with the results of word expansion when performing
360−@@ -5578,6 +5582,14 @@ Similar to @code{BASH_ENV}; used when th
361− The numeric effective user id of the current user. This variable
362− is readonly.
363−
364−+@item EXECIGNORE
365−+A colon-separated list of extended glob ((@pxref{Pattern Matching})
366−+patterns. Files with full paths matching one of these patterns are
367−+not considered executable for the purposes of completion and PATH
368−+searching, but the @code{[}, @code{[[}, and @code{test} builtins are
369−+not affected. Use this variable to deal with systems that set the
370−+executable bit on files that are not actually executable.
371−+
372− @item FCEDIT
373− The editor used as a default by the @option{-e} option to the @code{fc}
374− builtin command.
375−--- doc/builtins.1 2012-02-21 12:32:05.000000000 -0700
376−+++ doc/builtins.1 2015-02-06 17:14:11.031260100 -0700
377−@@ -19,6 +19,6 @@ shift, shopt, source, suspend, test, tim
378− ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)
379− .SH BASH BUILTIN COMMANDS
380− .nr zZ 1
381−-.so bash.1
382−+.so man1/bash.1
383− .SH SEE ALSO
384− bash(1), sh(1)
385−--- execute_cmd.c 2015-02-06 17:12:55.261573700 -0700
386−+++ execute_cmd.c 2015-02-06 17:14:11.031260100 -0700
387−@@ -58,6 +58,7 @@ extern int errno;
388− #endif
389−
390− #define NEED_FPURGE_DECL
391−+#define NEED_SH_SETLINEBUF_DECL /* used in externs.h */
392−
393− #include "bashansi.h"
394− #include "bashintl.h"
395−--- expr.c 2014-01-03 06:55:00.000000000 -0700
396−+++ expr.c 2015-02-06 17:14:11.031260100 -0700
397−@@ -83,6 +83,7 @@
398−
399− #include "shell.h"
400− #include "typemax.h" /* INTMAX_MAX, INTMAX_MIN */
401−+#define exp2 exp2_
402−
403− /* Because of the $((...)) construct, expressions may include newlines.
404− Here is a macro which accepts newlines, tabs and spaces as whitespace. */
405−--- findcmd.c 2012-10-15 05:45:04.000000000 -0600
406−+++ findcmd.c 2015-02-06 17:14:11.031260100 -0700
407−@@ -48,6 +48,8 @@
408− extern int errno;
409− #endif
410−
411−+#include <glob/strmatch.h>
412−+
413− extern int posixly_correct;
414− extern int last_command_exit_value;
415−
416−@@ -77,6 +79,38 @@ int check_hashed_filenames;
417− containing the file of interest. */
418− int dot_found_in_search = 0;
419−
420−+static struct ignorevar execignore =
421−+{
422−+ "EXECIGNORE",
423−+ (struct ign *)0,
424−+ 0,
425−+ (char *)0,
426−+ (sh_iv_item_func_t *)0,
427−+};
428−+
429−+void
430−+setup_exec_ignore (char *varname)
431−+{
432−+ setup_ignore_patterns (&execignore);
433−+}
434−+
435−+/* Return whether we should never consider file executable
436−+ * even if the system tells us it is. */
437−+static int
438−+is_on_exec_blacklist (char *name)
439−+{
440−+ struct ign *p;
441−+ int flags = FNM_EXTMATCH | FNM_CASEFOLD;
442−+
443−+ for (p = execignore.ignores; p && p->val; p++)
444−+ {
445−+ if (strmatch (p->val, (char *)name, flags) != FNM_NOMATCH)
446−+ return (1);
447−+ }
448−+
449−+ return (0);
450−+}
451−+
452− /* Return some flags based on information about this file.
453− The EXISTS bit is non-zero if the file is found.
454− The EXECABLE bit is non-zero the file is executble.
455−@@ -104,7 +138,7 @@ file_status (name)
456− file access mechanisms into account. eaccess uses the effective
457− user and group IDs, not the real ones. We could use sh_eaccess,
458− but we don't want any special treatment for /dev/fd. */
459−- if (eaccess (name, X_OK) == 0)
460−+ if (!is_on_exec_blacklist (name) && eaccess (name, X_OK) == 0)
461− r |= FS_EXECABLE;
462− if (eaccess (name, R_OK) == 0)
463− r |= FS_READABLE;
464−--- findcmd.h 2012-01-14 16:56:25.000000000 -0700
465−+++ findcmd.h 2015-02-06 17:14:11.031260100 -0700
466−@@ -31,5 +31,6 @@ extern char *find_user_command __P((cons
467− extern char *find_path_file __P((const char *));
468− extern char *search_for_command __P((const char *, int));
469− extern char *user_command_matches __P((const char *, int, int));
470−+extern void setup_exec_ignore __P((char *));
471−
472− #endif /* _FINDCMD_H_ */
473−--- general.c 2014-01-30 14:46:15.000000000 -0700
474−+++ general.c 2015-02-06 17:14:11.031260100 -0700
475−@@ -44,6 +44,10 @@
476−
477− #include <tilde/tilde.h>
478−
479−+#ifdef __CYGWIN__
480−+# include <sys/cygwin.h>
481−+#endif
482−+
483− #if !defined (errno)
484− extern int errno;
485− #endif /* !errno */
486−@@ -632,7 +636,8 @@ make_absolute (string, dot_path)
487− {
488− char pathbuf[PATH_MAX + 1];
489−
490−- cygwin_conv_to_full_posix_path (string, pathbuf);
491−+ cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, string, pathbuf,
492−+ sizeof pathbuf);
493− result = savestring (pathbuf);
494− }
495− #else
496−--- include/chartypes.h 2011-04-11 12:30:52.000000000 -0600
497−+++ include/chartypes.h 2015-02-06 17:14:11.031260100 -0700
498−@@ -40,6 +40,7 @@
499− #else
500− # define IN_CTYPE_DOMAIN(c) isascii(c)
501− #endif
502−+#define to_uchar(c) ((unsigned char)(c))
503−
504− #if !defined (isspace) && !defined (HAVE_ISSPACE)
505− # define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\f')
506−@@ -67,16 +68,16 @@
507−
508− #undef ISPRINT
509−
510−-#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
511−-#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
512−-#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
513−-#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
514−-#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
515−-#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
516−-#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
517−-#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
518−-#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
519−-#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
520−+#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (to_uchar (c)))
521−+#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (to_uchar (c)))
522−+#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (to_uchar (c)))
523−+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (to_uchar (c)))
524−+#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (to_uchar (c)))
525−+#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (to_uchar (c)))
526−+#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (to_uchar (c)))
527−+#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (to_uchar (c)))
528−+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (to_uchar (c)))
529−+#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (to_uchar (c)))
530−
531− #define ISLETTER(c) (ISALPHA(c))
532−
533−--- include/posixjmp.h 2012-12-23 20:20:50.000000000 -0700
534−+++ include/posixjmp.h 2015-02-06 17:14:11.031260100 -0700
535−@@ -27,13 +27,13 @@
536−
537− #if defined (HAVE_POSIX_SIGSETJMP)
538− # define procenv_t sigjmp_buf
539−-# if !defined (__OPENNT)
540−+# if !defined (__OPENNT) && !defined __CYGWIN__
541− # undef setjmp
542− # define setjmp(x) sigsetjmp((x), 1)
543−-# define setjmp_nosigs(x) sigsetjmp((x), 0)
544− # undef longjmp
545− # define longjmp(x, n) siglongjmp((x), (n))
546− # endif /* !__OPENNT */
547−+# define setjmp_nosigs(x) sigsetjmp((x), 0)
548− #else
549− # define procenv_t jmp_buf
550− # define setjmp_nosigs setjmp
551−--- input.c 2014-02-07 07:13:08.000000000 -0700
552−+++ input.c 2015-02-06 17:14:11.031260100 -0700
553−@@ -44,6 +44,10 @@
554− #include "quit.h"
555− #include "trap.h"
556−
557−+#if __CYGWIN__
558−+int igncr;
559−+#endif
560−+
561− #if !defined (errno)
562− extern int errno;
563− #endif /* !errno */
564−@@ -561,6 +565,19 @@ buffered_getchar ()
565− {
566− CHECK_TERMSIG;
567−
568−+#if __CYGWIN__
569−+ /* shopt igncr means to discard carriage returns from input stream.
570−+ If cr is the only character in the buffer, then recurse to pick
571−+ up the next character; otherwise flatten the buffer. */
572−+ if (igncr)
573−+ {
574−+ int ch;
575−+ while ((ch = bufstream_getc (buffers[bash_input.location.buffered_fd]))
576−+ == '\r')
577−+ ;
578−+ return ch;
579−+ }
580−+#endif /* __CYGWIN__ */
581− #if !defined (DJGPP)
582− return (bufstream_getc (buffers[bash_input.location.buffered_fd]));
583− #else
584−--- lib/readline/bind.c 2013-04-06 15:46:38.000000000 -0600
585−+++ lib/readline/bind.c 2015-02-06 17:14:11.031260100 -0700
586−@@ -452,7 +452,7 @@ rl_translate_keyseq (seq, array, len)
587− {
588− register int i, c, l, temp;
589−
590−- for (i = l = 0; c = seq[i]; i++)
591−+ for (i = l = 0; (c = seq[i]); i++)
592− {
593− if (c == '\\')
594− {
595−@@ -1210,7 +1210,7 @@ _rl_skip_to_delim (string, start, delim)
596− {
597− int i, c, passc;
598−
599−- for (i = start,passc = 0; c = string[i]; i++)
600−+ for (i = start,passc = 0; (c = string[i]); i++)
601− {
602− if (passc)
603− {
604−@@ -1297,7 +1297,6 @@ rl_parse_and_bind (string)
605− if (_rl_stricmp (string, "set") == 0)
606− {
607− char *var, *value, *e;
608−- int s;
609−
610− var = string + i;
611− /* Make VAR point to start of variable name. */
612−@@ -2198,7 +2197,7 @@ rl_function_dumper (print_readably)
613−
614− fprintf (rl_outstream, "\n");
615−
616−- for (i = 0; name = names[i]; i++)
617−+ for (i = 0; (name = names[i]); i++)
618− {
619− rl_command_func_t *function;
620− char **invokers;
621−--- lib/readline/chardefs.h 2011-07-25 19:47:56.000000000 -0600
622−+++ lib/readline/chardefs.h 2015-02-06 17:14:11.046889800 -0700
623−@@ -71,6 +71,7 @@
624− #else
625− # define IN_CTYPE_DOMAIN(c) isascii(c)
626− #endif
627−+#define to_uchar(c) ((unsigned char)(c))
628−
629− #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus)
630− # define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
631−@@ -87,13 +88,13 @@
632−
633− /* Beware: these only work with single-byte ASCII characters. */
634−
635−-#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
636−-#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
637−-#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
638−-#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
639−-#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
640−-#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
641−-#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
642−+#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (to_uchar (c)))
643−+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (to_uchar (c)))
644−+#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (to_uchar (c)))
645−+#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (to_uchar (c)))
646−+#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (to_uchar (c)))
647−+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (to_uchar (c)))
648−+#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (to_uchar (c)))
649−
650− #define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c))
651− #define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c))
652−--- lib/readline/complete.c 2013-10-14 07:27:10.000000000 -0600
653−+++ lib/readline/complete.c 2015-02-06 17:14:11.046889800 -0700
654−@@ -1082,7 +1082,7 @@ _rl_find_completion_word (fp, dp)
655− /* We didn't find an unclosed quoted substring upon which to do
656− completion, so use the word break characters to find the
657− substring on which to complete. */
658−- while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
659−+ while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)))
660− {
661− scan = rl_line_buffer[rl_point];
662−
663−@@ -2116,7 +2116,7 @@ rl_completion_matches (text, entry_funct
664− match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
665− match_list[1] = (char *)NULL;
666−
667−- while (string = (*entry_function) (text, matches))
668−+ while ((string = (*entry_function) (text, matches)))
669− {
670− if (RL_SIG_RECEIVED ())
671− {
672−@@ -2190,7 +2190,7 @@ rl_username_completion_function (text, s
673− }
674−
675− #if defined (HAVE_GETPWENT)
676−- while (entry = getpwent ())
677−+ while ((entry = getpwent ()))
678− {
679− /* Null usernames should result in all users as possible completions. */
680− if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
681−@@ -2723,7 +2723,7 @@ rl_menu_complete (count, ignore)
682− static int full_completion = 0; /* set to 1 if menu completion should reinitialize on next call */
683− static int orig_start, orig_end;
684− static char quote_char;
685−- static int delimiter, cstate;
686−+ static int delimiter;
687−
688− /* The first time through, we generate the list of matches and set things
689− up to insert them. */
690−--- lib/readline/display.c 2015-02-06 17:12:54.793574600 -0700
691−+++ lib/readline/display.c 2015-02-06 17:14:11.046889800 -0700
692−@@ -66,7 +66,6 @@ extern char *strchr (), *strrchr ();
693− static void update_line PARAMS((char *, char *, int, int, int, int));
694− static void space_to_eol PARAMS((int));
695− static void delete_chars PARAMS((int));
696−-static void insert_some_chars PARAMS((char *, int, int));
697− static void open_some_spaces PARAMS((int));
698− static void cr PARAMS((void));
699−
700−@@ -1314,7 +1313,7 @@ update_line (old, new, current_line, oma
701− int current_line, omax, nmax, inv_botlin;
702− {
703− register char *ofd, *ols, *oe, *nfd, *nls, *ne;
704−- int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
705−+ int temp, lendiff, wsatend, od, nd, o_cpos;
706− int current_invis_chars;
707− int col_lendiff, col_temp;
708− int bytes_to_insert;
709−@@ -2485,6 +2484,7 @@ _rl_clear_screen ()
710− #endif /* __DJGPP__ */
711− }
712−
713−+#if 0
714− /* Insert COUNT characters from STRING to the output stream at column COL. */
715− static void
716− insert_some_chars (string, count, col)
717−@@ -2494,6 +2494,7 @@ insert_some_chars (string, count, col)
718− open_some_spaces (col);
719− _rl_output_some_chars (string, count);
720− }
721−+#endif
722−
723− /* Insert COL spaces, keeping the cursor at the same position. We follow the
724− ncurses documentation and use either im/ei with explicit spaces, or IC/ic
725−--- lib/readline/histexpand.c 2013-12-02 07:22:30.000000000 -0700
726−+++ lib/readline/histexpand.c 2015-02-06 17:14:11.046889800 -0700
727−@@ -204,7 +204,7 @@ get_history_event (string, caller_index,
728− }
729−
730− /* Only a closing `?' or a newline delimit a substring search string. */
731−- for (local_index = i; c = string[i]; i++)
732−+ for (local_index = i; (c = string[i]); i++)
733− {
734− #if defined (HANDLE_MULTIBYTE)
735− if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
736−@@ -677,7 +677,7 @@ history_expand_internal (string, start,
737− case 's':
738− {
739− char *new_event;
740−- int delimiter, failed, si, l_temp, ws, we;
741−+ int delimiter, failed, si, l_temp, we;
742−
743− if (c == 's')
744− {
745−@@ -776,7 +776,6 @@ history_expand_internal (string, start,
746− {
747− for (; temp[si] && whitespace (temp[si]); si++)
748− ;
749−- ws = si;
750− we = history_tokenize_word (temp, si);
751− }
752−
753−--- lib/readline/histfile.c 2013-07-19 06:17:17.000000000 -0600
754−+++ lib/readline/histfile.c 2015-02-06 17:14:11.046889800 -0700
755−@@ -104,7 +104,7 @@ int history_write_timestamps = 0;
756−
757− /* Does S look like the beginning of a history timestamp entry? Placeholder
758− for more extensive tests. */
759−-#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char && isdigit ((s)[1]) )
760−+#define HIST_TIMESTAMP_START(s) (*(s) == history_comment_char && isdigit ((unsigned char) (s)[1]) )
761−
762− /* Return the string that should be used in the place of this
763− filename. This only matters when you don't specify the
764−--- lib/readline/input.c 2015-02-06 17:12:55.027577800 -0700
765−+++ lib/readline/input.c 2015-02-06 17:14:11.046889800 -0700
766−@@ -431,7 +431,7 @@ rl_read_key ()
767− else
768− {
769− /* If input is coming from a macro, then use that. */
770−- if (c = _rl_next_macro_key ())
771−+ if ((c = _rl_next_macro_key ()))
772− return (c);
773−
774− /* If the user has an event function, then call it periodically. */
775−--- lib/readline/isearch.c 2013-10-14 07:08:40.000000000 -0600
776−+++ lib/readline/isearch.c 2015-02-06 17:14:11.046889800 -0700
777−@@ -740,7 +740,7 @@ rl_search_history (direction, invoking_k
778− int direction, invoking_key;
779− {
780− _rl_search_cxt *cxt; /* local for now, but saved globally */
781−- int c, r;
782−+ int r;
783−
784− RL_SETSTATE(RL_STATE_ISEARCH);
785− cxt = _rl_isearch_init (direction);
786−@@ -755,7 +755,7 @@ rl_search_history (direction, invoking_k
787− r = -1;
788− for (;;)
789− {
790−- c = _rl_search_getchar (cxt);
791−+ _rl_search_getchar (cxt);
792− /* We might want to handle EOF here (c == 0) */
793− r = _rl_isearch_dispatch (cxt, cxt->lastc);
794− if (r <= 0)
795−@@ -778,9 +778,9 @@ int
796− _rl_isearch_callback (cxt)
797− _rl_search_cxt *cxt;
798− {
799−- int c, r;
800−+ int r;
801−
802−- c = _rl_search_getchar (cxt);
803−+ _rl_search_getchar (cxt);
804− /* We might want to handle EOF here */
805− r = _rl_isearch_dispatch (cxt, cxt->lastc);
806−
807−--- lib/readline/misc.c 2015-02-06 17:12:55.230384200 -0700
808−+++ lib/readline/misc.c 2015-02-06 17:14:11.046889800 -0700
809−@@ -455,7 +455,7 @@ _rl_revert_all_lines ()
810− entry = (hpos == history_length) ? previous_history () : current_history ();
811− while (entry)
812− {
813−- if (ul = (UNDO_LIST *)entry->data)
814−+ if ((ul = (UNDO_LIST *)entry->data))
815− {
816− if (ul == saved_undo_list)
817− saved_undo_list = 0;
818−@@ -502,7 +502,7 @@ rl_clear_history ()
819− for (i = 0; i < history_length; i++)
820− {
821− hent = hlist[i];
822−- if (ul = (UNDO_LIST *)hent->data)
823−+ if ((ul = (UNDO_LIST *)hent->data))
824− {
825− if (ul == saved_undo_list)
826− saved_undo_list = 0;
827−--- lib/readline/nls.c 2013-03-09 12:51:10.000000000 -0700
828−+++ lib/readline/nls.c 2015-02-06 17:14:11.046889800 -0700
829−@@ -80,7 +80,7 @@ static char *legal_lang_values[] =
830− static char *normalize_codeset PARAMS((char *));
831− #endif /* !HAVE_SETLOCALE */
832−
833−-static char *find_codeset PARAMS((char *, size_t *));
834−+static char *find_codeset PARAMS((char *, size_t *)) __attribute__ ((__unused__));
835−
836− static char *_rl_get_locale_var PARAMS((const char *));
837−
838−@@ -104,12 +104,13 @@ utf8locale (lspec)
839− char *lspec;
840− {
841− char *cp;
842−- size_t len;
843−
844− #if HAVE_LANGINFO_CODESET
845− cp = nl_langinfo (CODESET);
846− return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8"));
847− #else
848−+ size_t len;
849−+
850− cp = find_codeset (lspec, &len);
851−
852− if (cp == 0 || len < 4 || len > 5)
853−--- lib/readline/parens.c 2009-04-19 11:12:06.000000000 -0600
854−+++ lib/readline/parens.c 2015-02-06 17:14:11.046889800 -0700
855−@@ -106,7 +106,7 @@ rl_insert_close (count, invoking_key)
856− else
857− {
858− #if defined (HAVE_SELECT)
859−- int orig_point, match_point, ready;
860−+ int orig_point, match_point;
861− struct timeval timer;
862− fd_set readfds;
863−
864−@@ -126,7 +126,7 @@ rl_insert_close (count, invoking_key)
865− orig_point = rl_point;
866− rl_point = match_point;
867− (*rl_redisplay_function) ();
868−- ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
869−+ select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
870− rl_point = orig_point;
871− #else /* !HAVE_SELECT */
872− _rl_insert_char (count, invoking_key);
873−--- lib/readline/posixjmp.h 2012-12-23 20:20:50.000000000 -0700
874−+++ lib/readline/posixjmp.h 2015-02-06 17:14:11.046889800 -0700
875−@@ -27,13 +27,13 @@
876−
877− #if defined (HAVE_POSIX_SIGSETJMP)
878− # define procenv_t sigjmp_buf
879−-# if !defined (__OPENNT)
880−+# if !defined (__OPENNT) && !defined __CYGWIN__
881− # undef setjmp
882− # define setjmp(x) sigsetjmp((x), 1)
883−-# define setjmp_nosigs(x) sigsetjmp((x), 0)
884− # undef longjmp
885− # define longjmp(x, n) siglongjmp((x), (n))
886− # endif /* !__OPENNT */
887−+# define setjmp_nosigs(x) sigsetjmp((x), 0)
888− #else
889− # define procenv_t jmp_buf
890− # define setjmp_nosigs setjmp
891−--- lib/readline/readline.c 2015-02-06 17:12:54.310964200 -0700
892−+++ lib/readline/readline.c 2015-02-06 17:14:11.046889800 -0700
893−@@ -95,7 +95,7 @@ static void bind_arrow_keys_internal PAR
894− static void bind_arrow_keys PARAMS((void));
895−
896− static void readline_default_bindings PARAMS((void));
897−-static void reset_default_bindings PARAMS((void));
898−+//static void reset_default_bindings PARAMS((void));
899−
900− static int _rl_subseq_result PARAMS((int, Keymap, int, int));
901− static int _rl_subseq_getchar PARAMS((int));
902−@@ -522,7 +522,7 @@ readline_internal_char ()
903− readline_internal_charloop ()
904− #endif
905− {
906−- static int lastc, eof_found;
907−+ static int lastc, eof_found __attribute__((unused));
908− int c, code, lk;
909−
910− lastc = -1;
911−@@ -1204,6 +1204,7 @@ readline_default_bindings ()
912− rl_tty_set_default_bindings (_rl_keymap);
913− }
914−
915−+#if 0
916− /* Reset the default bindings for the terminal special characters we're
917− interested in back to rl_insert and read the new ones. */
918− static void
919−@@ -1215,6 +1216,7 @@ reset_default_bindings ()
920− rl_tty_set_default_bindings (_rl_keymap);
921− }
922− }
923−+#endif
924−
925− /* Bind some common arrow key sequences in MAP. */
926− static void
927−--- lib/readline/rltty.c 2013-08-25 14:57:05.000000000 -0600
928−+++ lib/readline/rltty.c 2015-02-06 17:14:11.062454900 -0700
929−@@ -30,6 +30,7 @@
930− #include <signal.h>
931− #include <errno.h>
932− #include <stdio.h>
933−+#include <sys/ioctl.h>
934−
935− #if defined (HAVE_UNISTD_H)
936− # include <unistd.h>
937−--- lib/readline/shell.c 2013-03-13 08:17:00.000000000 -0600
938−+++ lib/readline/shell.c 2015-02-06 17:14:11.062454900 -0700
939−@@ -123,8 +123,10 @@ sh_single_quote (string)
940− /* Set the environment variables LINES and COLUMNS to lines and cols,
941− respectively. */
942− static char setenv_buf[INT_STRLEN_BOUND (int) + 1];
943−+# if !defined (HAVE_SETENV) && defined (HAVE_PUTENV)
944− static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */
945− static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */
946−+# endif
947−
948− void
949− sh_set_lines_and_columns (lines, cols)
950−--- lib/readline/signals.c 2014-01-10 13:06:48.000000000 -0700
951−+++ lib/readline/signals.c 2015-02-06 17:14:11.062454900 -0700
952−@@ -576,7 +576,6 @@ rl_free_line_state ()
953− /* **************************************************************** */
954−
955− #if defined (HAVE_POSIX_SIGNALS)
956−-static sigset_t sigint_set, sigint_oset;
957− static sigset_t sigwinch_set, sigwinch_oset;
958− #else /* !HAVE_POSIX_SIGNALS */
959− # if defined (HAVE_BSD_SIGNALS)
960−--- lib/readline/terminal.c 2013-09-18 07:12:01.000000000 -0600
961−+++ lib/readline/terminal.c 2015-02-06 17:14:11.062454900 -0700
962−@@ -31,6 +31,7 @@
963− #if defined (HAVE_SYS_FILE_H)
964− # include <sys/file.h>
965− #endif /* HAVE_SYS_FILE_H */
966−+#include <sys/ioctl.h>
967−
968− #if defined (HAVE_UNISTD_H)
969− # include <unistd.h>
970−--- lib/readline/text.c 2013-10-14 07:25:05.000000000 -0600
971−+++ lib/readline/text.c 2015-02-06 17:14:11.062454900 -0700
972−@@ -859,11 +859,10 @@ _rl_overwrite_char (count, c)
973− int i;
974− #if defined (HANDLE_MULTIBYTE)
975− char mbkey[MB_LEN_MAX];
976−- int k;
977−
978− /* Read an entire multibyte character sequence to insert COUNT times. */
979− if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
980−- k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
981−+ _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
982− #endif
983−
984− rl_begin_undo_group ();
985−--- lib/readline/tilde.c 2010-07-25 15:42:13.000000000 -0600
986−+++ lib/readline/tilde.c 2015-02-06 17:14:11.062454900 -0700
987−@@ -196,7 +196,7 @@ tilde_expand (string)
988− int result_size, result_index;
989−
990− result_index = result_size = 0;
991−- if (result = strchr (string, '~'))
992−+ if ((result = strchr (string, '~')))
993− result = (char *)xmalloc (result_size = (strlen (string) + 16));
994− else
995− result = (char *)xmalloc (result_size = (strlen (string) + 1));
996−--- lib/readline/undo.c 2014-02-02 13:47:46.000000000 -0700
997−+++ lib/readline/undo.c 2015-02-06 17:14:11.062454900 -0700
998−@@ -124,7 +124,7 @@ _rl_free_undo_list (ul)
999− void
1000− rl_free_undo_list ()
1001− {
1002−- UNDO_LIST *release, *orig_list;
1003−+ UNDO_LIST *orig_list;
1004−
1005− orig_list = rl_undo_list;
1006− _rl_free_undo_list (rl_undo_list);
1007−--- lib/readline/vi_mode.c 2012-09-01 16:55:30.000000000 -0600
1008−+++ lib/readline/vi_mode.c 2015-02-06 17:14:11.062454900 -0700
1009−@@ -1089,7 +1089,7 @@ static int
1010− rl_domove_motion_callback (m)
1011− _rl_vimotion_cxt *m;
1012− {
1013−- int c, save, r;
1014−+ int c, r;
1015− int old_end;
1016−
1017− _rl_vi_last_motion = c = m->motion;
1018−@@ -1257,7 +1257,6 @@ int
1019− rl_vi_domove (x, ignore)
1020− int x, *ignore;
1021− {
1022−- int r;
1023− _rl_vimotion_cxt *m;
1024−
1025− m = _rl_vimvcxt;
1026−--- lib/sh/pathphys.c 2013-05-28 13:33:58.000000000 -0600
1027−+++ lib/sh/pathphys.c 2015-02-06 17:14:11.062454900 -0700
1028−@@ -35,6 +35,7 @@
1029− #include <stdio.h>
1030− #include <chartypes.h>
1031− #include <errno.h>
1032−+#include <stdlib.h>
1033−
1034− #include "shell.h"
1035−
1036−@@ -76,6 +77,10 @@ sh_physpath (path, flags)
1037− char *path;
1038− int flags;
1039− {
1040−+#if __CYGWIN__
1041−+ /* realpath does this correctly without all the hassle */
1042−+ return realpath (path, NULL);
1043−+#else
1044− char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1];
1045− char *result, *p, *q, *qsave, *qbase, *workpath;
1046− int double_slash_path, linklen, nlink;
1047−@@ -214,11 +219,7 @@ error:
1048− {
1049− q = result;
1050− /* Duplicating some code here... */
1051−-#if defined (__CYGWIN__)
1052−- qbase = (ISALPHA((unsigned char)workpath[0]) && workpath[1] == ':') ? workpath + 3 : workpath + 1;
1053−-#else
1054− qbase = workpath + 1;
1055−-#endif
1056− double_slash_path = DOUBLE_SLASH (workpath);
1057− qbase += double_slash_path;
1058−
1059−@@ -249,6 +250,7 @@ error:
1060− }
1061−
1062− return (result);
1063−+#endif /* ! __CYGWIN__ */
1064− }
1065−
1066− char *
1067−--- lib/sh/tmpfile.c 2013-12-18 15:50:13.000000000 -0700
1068−+++ lib/sh/tmpfile.c 2015-02-06 17:14:11.062454900 -0700
1069−@@ -96,7 +96,7 @@ get_tmpdir (flags)
1070− if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX))
1071− tdir = 0;
1072−
1073−- if (tdir == 0)
1074−+ if (tdir == 0 || !file_iswdir (tdir))
1075− tdir = get_sys_tmpdir ();
1076−
1077− #if defined (HAVE_PATHCONF) && defined (_PC_NAME_MAX)
1078−@@ -118,14 +118,15 @@ sh_mktmpname (nameroot, flags)
1079− struct stat sb;
1080− int r, tdlen;
1081−
1082−- filename = (char *)xmalloc (PATH_MAX + 1);
1083−+ filename = NULL;
1084− tdir = get_tmpdir (flags);
1085− tdlen = strlen (tdir);
1086−
1087− lroot = nameroot ? nameroot : DEFAULT_NAMEROOT;
1088−
1089− #ifdef USE_MKTEMP
1090−- sprintf (filename, "%s/%s.XXXXXX", tdir, lroot);
1091−+ if (asprintf (&filename, "%s/%s.XXXXXX", tdir, lroot) < 0)
1092−+ return NULL;
1093− if (mktemp (filename) == 0)
1094− {
1095− free (filename);
1096−@@ -138,7 +139,9 @@ sh_mktmpname (nameroot, flags)
1097− (unsigned long) time ((time_t *)0) ^
1098− (unsigned long) dollar_dollar_pid ^
1099− (unsigned long) ((flags & MT_USERANDOM) ? random () : ntmpfiles++);
1100−- sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum);
1101−+ free (filename);
1102−+ if (asprintf (&filename, "%s/%s-%lu", tdir, lroot, filenum) < 0)
1103−+ return NULL;
1104− if (tmpnamelen > 0 && tmpnamelen < 32)
1105− filename[tdlen + 1 + tmpnamelen] = '\0';
1106− # ifdef HAVE_LSTAT
1107−@@ -163,14 +166,19 @@ sh_mktmpfd (nameroot, flags, namep)
1108− char *filename, *tdir, *lroot;
1109− int fd, tdlen;
1110−
1111−- filename = (char *)xmalloc (PATH_MAX + 1);
1112−+ filename = NULL;
1113− tdir = get_tmpdir (flags);
1114− tdlen = strlen (tdir);
1115−
1116− lroot = nameroot ? nameroot : DEFAULT_NAMEROOT;
1117−
1118− #ifdef USE_MKSTEMP
1119−- sprintf (filename, "%s/%s.XXXXXX", tdir, lroot);
1120−+ if (asprintf (&filename, "%s/%s.XXXXXX", tdir, lroot) < 0)
1121−+ {
1122−+ if (namep)
1123−+ *namep = NULL;
1124−+ return -1;
1125−+ }
1126− fd = mkstemp (filename);
1127− if (fd < 0 || namep == 0)
1128− {
1129−@@ -187,7 +195,13 @@ sh_mktmpfd (nameroot, flags, namep)
1130− (unsigned long) time ((time_t *)0) ^
1131− (unsigned long) dollar_dollar_pid ^
1132− (unsigned long) ((flags & MT_USERANDOM) ? random () : ntmpfiles++);
1133−- sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum);
1134−+ free (filename);
1135−+ if (asprintf (&filename, "%s/%s-%lu", tdir, lroot, filenum) < 0)
1136−+ {
1137−+ if (namep)
1138−+ *namep = NULL;
1139−+ return -1;
1140−+ }
1141− if (tmpnamelen > 0 && tmpnamelen < 32)
1142− filename[tdlen + 1 + tmpnamelen] = '\0';
1143− fd = open (filename, BASEOPENFLAGS | ((flags & MT_READWRITE) ? O_RDWR : O_WRONLY), 0600);
1144−--- mksyntax.c 2012-07-29 17:48:38.000000000 -0600
1145−+++ mksyntax.c 2015-02-06 17:14:11.062454900 -0700
1146−@@ -29,13 +29,13 @@
1147−
1148− #ifdef HAVE_UNISTD_H
1149− # include <unistd.h>
1150−+#else
1151−+extern int optind;
1152−+extern char *optarg;
1153− #endif
1154−
1155− #include "syntax.h"
1156−
1157−-extern int optind;
1158−-extern char *optarg;
1159−-
1160− #ifndef errno
1161− extern int errno;
1162− #endif
1163−--- parse.y 2015-02-06 17:12:55.682776800 -0700
1164−+++ parse.y 2015-02-06 17:14:11.062454900 -0700
1165−@@ -1531,14 +1531,20 @@ yy_string_get ()
1166− string = bash_input.location.string;
1167−
1168− /* If the string doesn't exist, or is empty, EOF found. */
1169−- if (string && *string)
1170−+ while (string && *string)
1171− {
1172− c = *string++;
1173− bash_input.location.string = string;
1174−+#if __CYGWIN__
1175−+ {
1176−+ extern int igncr;
1177−+ if (igncr && c == '\r')
1178−+ continue;
1179−+ }
1180−+#endif
1181− return (c);
1182− }
1183−- else
1184−- return (EOF);
1185−+ return (EOF);
1186− }
1187−
1188− static int
1189−@@ -2305,7 +2311,7 @@ shell_getc (remove_quoted_newline)
1190− if (n <= 2) /* we have to save 1 for the newline added below */
1191− {
1192− if (truncating == 0)
1193−- internal_warning("shell_getc: shell_input_line_size (%zu) exceeds SIZE_MAX (%llu): line truncated", shell_input_line_size, SIZE_MAX);
1194−+ internal_warning("shell_getc: shell_input_line_size (%zu) exceeds SIZE_MAX (%zu): line truncated", shell_input_line_size, SIZE_MAX);
1195− shell_input_line[i] = '\0';
1196− truncating = 1;
1197− }
1198−@@ -3582,7 +3588,6 @@ parse_comsub (qc, open, close, lenp, fla
1199−
1200− while (count)
1201− {
1202−-comsub_readchar:
1203− ch = shell_getc (qc != '\'' && (tflags & (LEX_INCOMMENT|LEX_PASSNEXT)) == 0);
1204−
1205− if (ch == EOF)
1206−--- pathexp.h 2009-01-04 12:32:40.000000000 -0700
1207−+++ pathexp.h 2015-02-06 17:14:11.062454900 -0700
1208−@@ -86,7 +86,7 @@ struct ign {
1209− typedef int sh_iv_item_func_t __P((struct ign *));
1210−
1211− struct ignorevar {
1212−- char *varname; /* FIGNORE or GLOBIGNORE */
1213−+ char *varname; /* FIGNORE or GLOBIGNORE or EXECIGNORE */
1214− struct ign *ignores; /* Store the ignore strings here */
1215− int num_ignores; /* How many are there? */
1216− char *last_ignoreval; /* Last value of variable - cached for speed */
1217−--- redir.c 2013-10-14 07:19:59.000000000 -0600
1218−+++ redir.c 2015-02-06 17:14:11.078059300 -0700
1219−@@ -156,7 +156,6 @@ redirection_error (temp, error)
1220− #endif
1221− else if (expandable_redirection_filename (temp))
1222− {
1223−-expandable_filename:
1224− oflags = temp->redirectee.filename->flags;
1225− if (posixly_correct && interactive_shell == 0)
1226− temp->redirectee.filename->flags |= W_NOGLOB;
1227−--- subst.c 2015-02-06 17:12:55.370841100 -0700
1228−+++ subst.c 2015-02-06 17:14:11.078059300 -0700
1229−@@ -41,6 +41,7 @@
1230− #include "posixstat.h"
1231− #include "bashintl.h"
1232−
1233−+#define NEED_SH_SETLINEBUF_DECL /* used in externs.h */
1234− #include "shell.h"
1235− #include "parser.h"
1236− #include "flags.h"
1237−@@ -5268,6 +5269,13 @@ read_comsub (fd, quoted, rflag)
1238− #endif
1239− continue;
1240− }
1241−+#if __CYGWIN__
1242−+ {
1243−+ extern int igncr;
1244−+ if (igncr && c == '\r')
1245−+ continue;
1246−+ }
1247−+#endif /* __CYGWIN__ */
1248−
1249− /* Add the character to ISTRING, possibly after resizing it. */
1250− RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
1251−@@ -5385,6 +5393,28 @@ command_substitute (string, quoted)
1252− goto error_exit;
1253− }
1254−
1255−+#if __CYGWIN__
1256−+ /* Passing a pipe through std fds can cause hangs when talking to a
1257−+ non-cygwin child. Move it. */
1258−+ if (fildes[0] < 3)
1259−+ {
1260−+ int fd = fcntl (fildes[0], F_DUPFD, 3);
1261−+ close (fildes[0]);
1262−+ fildes[0] = fd;
1263−+ }
1264−+ if (fildes[1] < 3)
1265−+ {
1266−+ int fd = fcntl (fildes[1], F_DUPFD, 3);
1267−+ close (fildes[1]);
1268−+ fildes[1] = fd;
1269−+ }
1270−+ if (fildes[0] < 0 || fildes[1] < 0)
1271−+ {
1272−+ sys_error (_("cannot make pipe for command substitution"));
1273−+ goto error_exit;
1274−+ }
1275−+#endif /* __CYGWIN__ */
1276−+
1277− old_pid = last_made_pid;
1278− #if defined (JOB_CONTROL)
1279− old_pipeline_pgrp = pipeline_pgrp;
1280−--- support/bashversion.c 2008-09-09 07:31:53.000000000 -0600
1281−+++ support/bashversion.c 2015-02-06 17:14:11.078059300 -0700
1282−@@ -26,6 +26,9 @@
1283−
1284− #if defined (HAVE_UNISTD_H)
1285− # include <unistd.h>
1286−+#else
1287−+extern int optind;
1288−+extern char *optarg;
1289− #endif
1290−
1291− #include "bashansi.h"
1292−@@ -41,9 +44,6 @@
1293− #define LFLAG 0x0020
1294− #define XFLAG 0x0040
1295−
1296−-extern int optind;
1297−-extern char *optarg;
1298−-
1299− extern char *dist_version;
1300− extern int patch_level;
1301−
1302−@@ -65,7 +65,7 @@ main (argc, argv)
1303− char **argv;
1304− {
1305− int opt, oflags;
1306−- char dv[128], *rv;
1307−+ char dv[128], *rv = NULL;
1308−
1309− if (progname = strrchr (argv[0], '/'))
1310− progname++;
1311−--- support/mkversion.sh 2008-08-13 06:25:57.000000000 -0600
1312−+++ support/mkversion.sh 2015-02-06 17:14:11.078059300 -0700
1313−@@ -29,7 +29,7 @@ source_dir="."
1314− while [ $# -gt 0 ]; do
1315− case "$1" in
1316− -o) shift; OUTFILE=$1; shift ;;
1317−- -b) shift; inc_build=yes ;;
1318−+ -b) shift; ;;# inc_build=yes ;; # hacked out for cygport
1319− -s) shift; rel_status=$1; shift ;;
1320− -p) shift; patch_level=$1; shift ;;
1321− -d) shift; dist_version=$1; shift ;;
1322−--- variables.c 2015-02-06 17:12:55.729569600 -0700
1323−+++ variables.c 2015-02-06 17:14:11.078059300 -0700
1324−@@ -2526,9 +2526,9 @@ bind_variable_internal (name, value, tab
1325−
1326− newname = 0;
1327− #if defined (ARRAY_VARS)
1328−- if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference (name))
1329−+ if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference ((char *)name))
1330− {
1331−- newname = array_variable_name (name, &subp, &sublen);
1332−+ newname = array_variable_name ((char*)name, &subp, &sublen);
1333− if (newname == 0)
1334− return (SHELL_VAR *)NULL; /* XXX */
1335− entry = hash_lookup (newname, table);
1336−@@ -2573,13 +2573,13 @@ bind_variable_internal (name, value, tab
1337− entry = make_new_array_variable (newname); /* indexed array by default */
1338− if (entry == 0)
1339− return entry;
1340−- ind = array_expand_index (name, subp, sublen);
1341−+ ind = array_expand_index (entry, subp, sublen);
1342− bind_array_element (entry, ind, value, aflags);
1343− }
1344− #endif
1345− else if (entry == 0)
1346− {
1347−- entry = make_new_variable (name, table);
1348−+ entry = make_new_variable ((char*)name, table);
1349− var_setvalue (entry, make_variable_value (entry, value, 0)); /* XXX */
1350− }
1351− else if (entry->assign_func) /* array vars have assign functions now */
1352−@@ -4679,6 +4679,8 @@ static struct name_and_function special_
1353− { "COMP_WORDBREAKS", sv_comp_wordbreaks },
1354− #endif
1355−
1356−+ { "EXECIGNORE", sv_execignore },
1357−+
1358− { "FUNCNEST", sv_funcnest },
1359−
1360− { "GLOBIGNORE", sv_globignore },
1361−@@ -4877,6 +4879,13 @@ sv_globignore (name)
1362− setup_glob_ignore (name);
1363− }
1364−
1365−+/* What to do when EXECIGNORE changes. */
1366−+void
1367−+sv_execignore (char *name)
1368−+{
1369−+ setup_exec_ignore (name);
1370−+}
1371−+
1372− #if defined (READLINE)
1373− void
1374− sv_comp_wordbreaks (name)
1375−@@ -4950,7 +4959,7 @@ sv_winsize (name)
1376− /* Update the value of HOME in the export environment so tilde expansion will
1377− work on cygwin. */
1378− #if defined (__CYGWIN__)
1379−-sv_home (name)
1380−+void sv_home (name)
1381− char *name;
1382− {
1383− array_needs_making = 1;
1384−--- variables.h 2014-01-08 13:33:29.000000000 -0700
1385−+++ variables.h 2015-02-06 17:14:11.078059300 -0700
1386−@@ -372,6 +372,7 @@ extern void sv_ifs __P((char *));
1387− extern void sv_path __P((char *));
1388− extern void sv_mail __P((char *));
1389− extern void sv_funcnest __P((char *));
1390−+extern void sv_execignore __P((char *));
1391− extern void sv_globignore __P((char *));
1392− extern void sv_ignoreeof __P((char *));
1393− extern void sv_strict_posix __P((char *));