2011-05-20 Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* cdjpeg.c [__DJGPP__]: Include <sys/exceptn.h>	for  __djgpp_set_ctrl_c
	declaration and <unistd.h> for isatty declaration.
	(read_stdin) [__DJGPP__]: Reenable SIGINT and SIGQUIT if stdin is
	connected to console and has been switched to binary mode.
	(write_stdout) [__DJGPP__]: Reenable SIGINT and SIGQUIT if stdout is
	connected to console and has been switched to binary mode.





diff -aprNU5 libjpeg.8c.orig/cdjpeg.c libjpeg.8c/cdjpeg.c
--- libjpeg.8c.orig/cdjpeg.c	1997-09-07 15:51:36 +0000
+++ libjpeg.8c/cdjpeg.c	2011-05-20 21:55:58 +0000
@@ -16,10 +16,14 @@
 #endif
 #ifdef USE_SETMODE
 #include <fcntl.h>		/* to declare setmode()'s parameter macros */
 /* If you have setmode() but not <io.h>, just delete this line: */
 #include <io.h>			/* to declare setmode() */
+#ifdef __DJGPP__
+#include <unistd.h>		/* to declare isatty() */
+#include <sys/exceptn.h>	/* to declare __djgpp_set_ctrl_c() */
+#endif
 #endif
 
 
 /*
  * Signal catcher to ensure that temporary files are removed before aborting.
@@ -150,10 +154,17 @@ read_stdin (void)
 {
   FILE * input_file = stdin;
 
 #ifdef USE_SETMODE		/* need to hack file mode? */
   setmode(fileno(stdin), O_BINARY);
+#ifdef __DJGPP__
+  /* This is DJGPP-specific.  By default, switching console
+     to binary mode disables SIGINT and SIGQUIT.  But we want
+     terminal reads to be interruptible.  */
+  if (isatty(fileno(stdin)))
+    __djgpp_set_ctrl_c(1);
+#endif
 #endif
 #ifdef USE_FDOPEN		/* need to re-open in binary mode? */
   if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) {
     fprintf(stderr, "Cannot reopen stdin\n");
     exit(EXIT_FAILURE);
@@ -168,10 +179,17 @@ write_stdout (void)
 {
   FILE * output_file = stdout;
 
 #ifdef USE_SETMODE		/* need to hack file mode? */
   setmode(fileno(stdout), O_BINARY);
+#ifdef __DJGPP__
+  /* This is DJGPP-specific.  By default, switching console
+     to binary mode disables SIGINT and SIGQUIT.  But we want
+     terminal writes to be interruptible.  */
+  if (isatty(fileno(stdout)))
+    __djgpp_set_ctrl_c(1);
+#endif
 #endif
 #ifdef USE_FDOPEN		/* need to re-open in binary mode? */
   if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) {
     fprintf(stderr, "Cannot reopen stdout\n");
     exit(EXIT_FAILURE);
