]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/console/conio.c
Change copyright as per agreement with FSFE
[bacula/bacula] / bacula / src / console / conio.c
index f35dda89762898261bf99b776738e22115a43b7b..03860afbe02d70e4066ac76f5a4374dbb60f6d17 100755 (executable)
@@ -1,30 +1,20 @@
 /*
-   Bacula® - The Network Backup Solution
-
-   Copyright (C) 1981-2009 Free Software Foundation Europe e.V.
-             Yes, that is 1981 no error.
-
-   The main author of Bacula is Kern Sibbald, with contributions from
-   many others, a complete list can be found in the file AUTHORS.
-   This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation and included
-   in the file LICENSE.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-   Bacula® is a registered trademark of Kern Sibbald.
-   The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-   Switzerland, email:ftf@fsfeurope.org.
+   Bacula(R) - The Network Backup Solution
+
+   Copyright (C) 2000-2015 Kern Sibbald
+
+   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.
+
+   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
@@ -54,6 +44,7 @@
 #include <signal.h>
 #include <string.h>
 #include <ctype.h>
+#define HAVE_CONIO 1
 #else
 
 /* We are in Bacula */
 
 #endif
 
-#include <termios.h>
+#ifdef HAVE_CONIO
+
+#include <curses.h>
+#include <term.h>
+
 #ifdef HAVE_SUN_OS
+#ifndef _TERM_H
 extern "C" int tgetent(void *, const char *);
 extern "C" int tgetnum(const char *);
 extern "C" char *tgetstr (const char*, char**);
+# Note: the following on older (Solaris 10) systems
+#  may need to be moved to after the #endif
 extern "C" char *tgoto (const char *, int, int);
-#elif HAVE_HPUX_OS
-#include <term.h>
-#elif HAVE_AIX_OS 
-#include <curses.h>
-#include <term.h>
+#endif
 #elif defined(__sgi)
 extern "C" int tgetent(char *, char *);
 extern "C" int tgetnum(char id[2]);
@@ -82,9 +76,6 @@ extern "C" int tgetent(void *, const char *);
 extern "C" int tgetnum(const char *);
 extern "C" char *tgetstr (const char*, char**);
 extern "C" char *tgoto (const char *, int, int);
-
-#else
-#include <termcap.h>
 #endif
 #include "func.h"
 
@@ -150,9 +141,9 @@ static char *kE;                             /* end */
  */
 typedef struct s_stab {
    struct s_stab *next;
+   char *str;
    int len;
    int func;
-   char *str;
 } stab_t;
 
 #define MAX_STAB 30
@@ -457,9 +448,8 @@ input_char()
     }
     /* if we got a screen size escape sequence, read height, width */
     if (c == F_SCRSIZ) {
-       int y, x;
-       y = t_gnc() - 0x20;        /* y */
-       x = t_gnc() - 0x20;        /* x */
+       t_gnc();   /*  - 0x20 = y */
+       t_gnc();   /*  - 0x20 = x */
        c = input_char();
     }
     return c;
@@ -876,13 +866,13 @@ putline(char *newl, int newlen)
        nptr->nextl->prevl = lptr;
        lptr->len += nptr->len;
    }
-   if (lptr->len > newlen + 2 * PHDRL) { /* split buffer */
+   if (lptr->len > newlen + 2 * PHDRL + 7) { /* split buffer */
        nptr = (struct lstr *)((char *)lptr + newlen + PHDRL);
-       /* Appropriate byte alignment - normally 2 byte, but on
-          sparc we need 4 byte alignment, so we always do 4 */
-       if (((long unsigned)nptr & 3) != 0) { /* test four byte alignment */
+       /* Appropriate byte alignment - for Intel 2 byte, but on
+          Sparc we need 8 byte alignment, so we always do 8 */
+       if (((long unsigned)nptr & 7) != 0) { /* test eight byte alignment */
            p = (char *)nptr;
-           nptr = (struct lstr *)((((long unsigned) p) & ~3) + 4);
+           nptr = (struct lstr *)((((long unsigned) p) & ~7) + 8);
        }
        nptr->len = lptr->len - ((char *)nptr - (char *)lptr);
        lptr->len -= nptr->len;
@@ -1194,3 +1184,5 @@ static void asdell()
 {
    t_send(t_dl);
 }
+
+#endif