# HG changeset patch
# User John Donoghue <john.donoghue@ieee.org>
# Date 1408156054 14400
#      Fri Aug 15 22:27:34 2014 -0400
# Node ID 429fd5eccfc818d469b488d34702a1ff2c19736b
# Parent  5c5642ed209b6a212a2cda84cccfdd64c2bedb52
octave: add gnulib isatty fix patch

* src/octave-1-gnulib-isatty.patch: added file.

* src/stable-octave-1-gnulib-isatty.patch: added file

* dist-files.mk: added octave-1-gnulib-isatty.patch, stable-octave-1-gnulib-isatty.patch

* makeinst-script.sh: removed --line-editing option from shortcuts if Win8.

diff -r 5c5642ed209b -r 429fd5eccfc8 dist-files.mk
--- a/dist-files.mk	Wed Aug 13 13:51:21 2014 -0400
+++ b/dist-files.mk	Fri Aug 15 22:27:34 2014 -0400
@@ -426,6 +426,7 @@
   ocaml-native.mk \
   octave-1-docinstall.patch \
   octave-1-fixes.patch \
+  octave-1-gnulib-isatty.patch \
   octave.mk \
   of-actuarial.mk \
   of-communications.mk \
@@ -559,6 +560,7 @@
   sqlite.mk \
   stable-octave-1-docinstall.patch \
   stable-octave-1-fixes.patch \
+  stable-octave-1-gnulib-isatty.patch \
   stable-octave.mk \
   suitesparse-1.patch \
   suitesparse.mk \
diff -r 5c5642ed209b -r 429fd5eccfc8 makeinst-script.sh
--- a/makeinst-script.sh	Wed Aug 13 13:51:21 2014 -0400
+++ b/makeinst-script.sh	Fri Aug 15 22:27:34 2014 -0400
@@ -257,13 +257,8 @@
  CreateDirectory "\$SMPROGRAMS\\Octave-$VERSION"
  CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0
  SetOutPath "%USERPROFILE%"
- \${If} \$IsWin8 == 1
-   CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "-i --line-editing" "\$INSTDIR\\$ICON" 0
-   CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "-i --line-editing" "\$INSTDIR\\$ICON" 0
- \${Else}
-   CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0
-   CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0
- \${EndIf}
+ CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0
+ CreateShortCut "\$SMPROGRAMS\\Octave-$VERSION\\Octave (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0
  SetOutPath "\$INSTDIR"
 EOF
   # if we have documentation files, create shortcuts
@@ -281,13 +276,8 @@
 
   \${If} \$InstallShortcuts == \${BST_CHECKED}
     SetOutPath "%USERPROFILE%"
-    \${If} \$IsWin8 == 1
-       CreateShortCut "\$desktop\\Octave-$VERSION (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "-i --line-editing" "\$INSTDIR\\$ICON" 0
-       CreateShortCut "\$desktop\\Octave-$VERSION (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "-i --line-editing" "\$INSTDIR\\$ICON" 0
-    \${Else}
-       CreateShortCut "\$desktop\\Octave-$VERSION (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0
-       CreateShortCut "\$desktop\\Octave-$VERSION (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0
-    \${EndIf}
+    CreateShortCut "\$desktop\\Octave-$VERSION (Command Line).lnk" "\$INSTDIR\\bin\\octave-cli.exe" "" "\$INSTDIR\\$ICON" 0
+    CreateShortCut "\$desktop\\Octave-$VERSION (Experimental GUI).lnk" "\$INSTDIR\\bin\\octave-gui.exe" "" "\$INSTDIR\\$ICON" 0
   \${Endif}
 
   ; BLAS set up
diff -r 5c5642ed209b -r 429fd5eccfc8 src/octave-1-gnulib-isatty.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/octave-1-gnulib-isatty.patch	Fri Aug 15 22:27:34 2014 -0400
@@ -0,0 +1,39 @@
+Patch based on savannah.gnu.org/bugs/?327623#attached
+
+diff -ur octave-3.8.2-rc2.orig/libgnu/isatty.c octave-3.8.2-rc2/libgnu/isatty.c
+--- octave-3.8.2-rc2.orig/libgnu/isatty.c	2014-08-12 15:31:01.710229546 -0400
++++ octave-3.8.2-rc2/libgnu/isatty.c	2014-08-12 15:41:15.603406658 -0400
+@@ -34,7 +34,13 @@
+ 
+ /* Optimized test whether a HANDLE refers to a console.
+    See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>.  */
+-#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
++//#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
++static BOOL
++IsConsoleHandle(HANDLE h)
++{
++  DWORD mode;
++  return GetConsoleMode(h, &mode) != 0;
++}
+ 
+ #if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+ static int
+diff -ur octave-3.8.2-rc2.orig/libgnu/select.c octave-3.8.2-rc2/libgnu/select.c
+--- octave-3.8.2-rc2.orig/libgnu/select.c	2014-08-12 15:31:01.704229427 -0400
++++ octave-3.8.2-rc2/libgnu/select.c	2014-08-12 15:44:44.268552023 -0400
+@@ -84,7 +84,14 @@
+ 
+ /* Optimized test whether a HANDLE refers to a console.
+    See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>.  */
+-#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
++//#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
++static BOOL
++IsConsoleHandle(HANDLE h)
++{
++  DWORD mode;
++  return GetConsoleMode(h, &mode) != 0;
++}
++
+ 
+ static BOOL
+ IsSocketHandle (HANDLE h)
diff -r 5c5642ed209b -r 429fd5eccfc8 src/stable-octave-1-gnulib-isatty.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/stable-octave-1-gnulib-isatty.patch	Fri Aug 15 22:27:34 2014 -0400
@@ -0,0 +1,39 @@
+Patch based on savannah.gnu.org/bugs/?327623#attached
+
+diff -ur octave-3.8.2-rc2.orig/libgnu/isatty.c octave-3.8.2-rc2/libgnu/isatty.c
+--- octave-3.8.2-rc2.orig/libgnu/isatty.c	2014-08-12 15:31:01.710229546 -0400
++++ octave-3.8.2-rc2/libgnu/isatty.c	2014-08-12 15:41:15.603406658 -0400
+@@ -34,7 +34,13 @@
+ 
+ /* Optimized test whether a HANDLE refers to a console.
+    See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>.  */
+-#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
++//#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
++static BOOL
++IsConsoleHandle(HANDLE h)
++{
++  DWORD mode;
++  return GetConsoleMode(h, &mode) != 0;
++}
+ 
+ #if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+ static int
+diff -ur octave-3.8.2-rc2.orig/libgnu/select.c octave-3.8.2-rc2/libgnu/select.c
+--- octave-3.8.2-rc2.orig/libgnu/select.c	2014-08-12 15:31:01.704229427 -0400
++++ octave-3.8.2-rc2/libgnu/select.c	2014-08-12 15:44:44.268552023 -0400
+@@ -84,7 +84,14 @@
+ 
+ /* Optimized test whether a HANDLE refers to a console.
+    See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>.  */
+-#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
++//#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
++static BOOL
++IsConsoleHandle(HANDLE h)
++{
++  DWORD mode;
++  return GetConsoleMode(h, &mode) != 0;
++}
++
+ 
+ static BOOL
+ IsSocketHandle (HANDLE h)
