]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/console/conio.c
Big backport from Enterprise
[bacula/bacula] / bacula / src / console / conio.c
index bf284da6a3f2254b0b6d48ffadee59d609b17310..8a5e117e8b05167802c8580d3baec2b01e082933 100755 (executable)
@@ -1,24 +1,28 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 1981-2014 Free Software Foundation Europe e.V.
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
-*/
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
 
+   Bacula(R) is a registered trademark of Kern Sibbald.
+*/
 /*
-  Generalized console input/output handler
-  A maintanable replacement for readline()
+      Generalized console input/output handler
+      A maintanable replacement for readline()
 
-  Written in 1981, updated for Bacula, Kern Sibbald, December MMIII
+         Updated for Bacula, Kern Sibbald, December MMIII
+
+      This code is in part derived from code that I wrote in
+      1981, so some of it is a bit old and could use a cleanup.
 
 */
 
@@ -31,6 +35,7 @@
  *  Each subsequent character starts with 10 (i.e. (c & 0xC0) == 0x80)
  */
 
+
 #ifdef  TEST_PROGRAM
 #include <stdio.h>
 #include <unistd.h>
@@ -83,11 +88,6 @@ extern char *BC;
 extern char *UP;
 #endif
 
-/* Forward referenced functions */
-extern "C" {
-static void sigintcatcher(int);
-}
-
 static void add_smap(char *str, int func);
 
 
@@ -251,9 +251,7 @@ static void asinsl();
 static void asdell();
 
 int input_line(char *string, int length);
-extern "C" {
 void con_term();
-}
 void trapctlc();
 int usrbrk();
 void clrbrk();
@@ -968,7 +966,7 @@ static void rawmode(FILE *input)
    /* Defaults, the main program can override these */
    signal(SIGQUIT, SIG_IGN);
    signal(SIGHUP, SIG_IGN);
-   signal(SIGINT, sigintcatcher);
+   trapctlc();
    signal(SIGWINCH, SIG_IGN);
 
    if (!termtype) {
@@ -1092,41 +1090,6 @@ t_char(char c)
    (void)write(1, &c, 1);
 }
 
-
-static int brkflg = 0;              /* set on user break */
-
-/* Routine to return true if user types break */
-int usrbrk()
-{
-   return brkflg;
-}
-
-/* Clear break flag */
-void clrbrk()
-{
-   brkflg = 0;
-
-}
-
-/* Interrupt caught here */
-static void sigintcatcher(int sig)
-{
-   brkflg++;
-   if (brkflg > 3) {
-      normode();
-      exit(1);
-   }
-   signal(SIGINT, sigintcatcher);
-}
-
-
-/* Trap Ctl-C */
-void trapctlc()
-{
-   signal(SIGINT, sigintcatcher);
-}
-
-
 /* ASCLRL() -- Clear to end of line from current position */
 static void asclrl(int pos, int width)
 {