/* Set if Bacula conio support enabled */
#undef HAVE_CONIO
+/* Define to 1 if you have the <curses.h> header file. */
+#undef HAVE_CURSES_H
+
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
AC_PROG_CC_C_O dnl Determine if C compiler support -c -o.
AC_PROG_GCC_TRADITIONAL dnl Determine if ioctl() need -traditional.
-if test x$CC = xgcc
+if test "x$CC" = xgcc
then
AC_DEFINE(HAVE_GCC)
fi
AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
])
])
+ ],
+ [
+ AC_CHECK_HEADERS(curses.h)
+ AC_CHECK_HEADER(term.h,
+ [ AC_CHECK_LIB(curses, tgetent,
+ [ CONS_LIBS="-lcurses"
+ CONS_OBJ="conio.o"
+ CONS_SRC="conio.c"
+ got_conio="yes"
+ support_readline=no
+ AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
+ ])
+ ],
+ [ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "],
+[#if HAVE_CURSES_H
+#include <curses.h>
+#endif
+])
])
-
- AC_CHECK_HEADER(term.h,
- [ AC_CHECK_LIB(curses, tgetent,
- [ CONS_LIBS="-lcurses"
- CONS_OBJ="conio.o"
- CONS_SRC="conio.c"
- got_conio="yes"
- support_readline=no
- AC_DEFINE(HAVE_CONIO, 1, [Set if Bacula conio support enabled])
- ])
- ])
fi
fi
fi
-if test x$CC = xgcc
+if test "x$CC" = xgcc
then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GCC 1
fi
-fi
-
+else
- if test "${ac_cv_header_term_h+set}" = set; then
- echo "$as_me:$LINENO: checking for term.h" >&5
-echo $ECHO_N "checking for term.h... $ECHO_C" >&6
-if test "${ac_cv_header_term_h+set}" = set; then
+for ac_header in curses.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-echo "$as_me:$LINENO: result: $ac_cv_header_term_h" >&5
-echo "${ECHO_T}$ac_cv_header_term_h" >&6
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking term.h usability" >&5
-echo $ECHO_N "checking term.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
-#include <term.h>
+#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
-echo "$as_me:$LINENO: checking term.h presence" >&5
-echo $ECHO_N "checking term.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <term.h>
+#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
- { echo "$as_me:$LINENO: WARNING: term.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: term.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: term.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: term.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
sed "s/^/$as_me: WARNING: /" >&2
;;
no:yes )
- { echo "$as_me:$LINENO: WARNING: term.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: term.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: term.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: term.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: term.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: term.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
-echo "$as_me:$LINENO: checking for term.h" >&5
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ echo "$as_me:$LINENO: checking for term.h" >&5
echo $ECHO_N "checking for term.h... $ECHO_C" >&6
if test "${ac_cv_header_term_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_header_term_h=$ac_header_preproc
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_CURSES_H
+#include <curses.h>
+#endif
+
+
+#include <term.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_term_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_term_h=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_header_term_h" >&5
echo "${ECHO_T}$ac_cv_header_term_h" >&6
-
-fi
if test $ac_cv_header_term_h = yes; then
echo "$as_me:$LINENO: checking for tgetent in -lcurses" >&5
echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6
echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6
if test $ac_cv_lib_curses_tgetent = yes; then
CONS_LIBS="-lcurses"
- CONS_OBJ="conio.o"
- CONS_SRC="conio.c"
- got_conio="yes"
- support_readline=no
+ CONS_OBJ="conio.o"
+ CONS_SRC="conio.c"
+ got_conio="yes"
+ support_readline=no
cat >>confdefs.h <<\_ACEOF
#define HAVE_CONIO 1
fi
+else
+ echo " "; echo "Required libraries not found. CONIO turned off ..."; echo " "
+fi
+
+
+
fi
extern char *UP;
/* Forward referenced functions */
+extern "C" {
static void sigintcatcher(int);
+}
+
static void add_smap(char *str, int func);
/* Global variables */
-static char *t_up = "\n"; /* scroll up character */
-static char *t_honk = "\007"; /* sound beep */
+static const char *t_up = "\n"; /* scroll up character */
+static const char *t_honk = "\007"; /* sound beep */
static char *t_il; /* insert line */
static char *t_dl; /* delete line */
static char *t_cs; /* clear screen */
static void t_delete_line(void);
static void t_clrline(int pos, int width);
void t_sendl(const char *msg, int len);
-void t_send(char *msg);
+void t_send(const char *msg);
void t_char(char c);
static void asclrs();
static void ascurs(int y, int x);
static void asdell();
int input_line(char *string, int length);
+extern "C" {
void con_term();
+}
void trapctlc();
int usrbrk();
void clrbrk();
/* Helper function to add string preceded by
* ESC to smap table */
-static void add_esc_smap(char *str, int func)
+static void add_esc_smap(const char *str, int func)
{
char buf[1000];
buf[0] = 0x1B; /* esc */
}
void
-t_send(char *msg)
+t_send(const char *msg)
{
if (msg == NULL) {
return;
#define __CONIO_H
extern int input_line(char *line, int len);
extern void con_init(FILE *input);
+
+extern "C" {
extern void con_term();
+}
+
extern void con_set_zed_keys();
extern void t_sendl(char *buf, int len);
extern void t_send(char *buf);
continue;
}
/*
- * Receive notification when connection dies.
+ * Keep socket from timing out from inactivity
*/
- if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t) & turnon,
- sizeof(turnon)) < 0) {
+ if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
berrno be;
Qmsg1(jcr, M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
be.strerror());
errno = save_errno;
return NULL;
}
+ /*
+ * Keep socket from timing out from inactivity
+ * Do this a second time out of paranoia
+ */
+ if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
+ berrno be;
+ Qmsg1(jcr, M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
+ be.strerror());
+ }
BSOCK* ret = init_bsock(jcr, sockfd, name, host, port, ipaddr->get_sockaddr());
free_addresses(addr_list);
return ret;
/*
* Reuse old sockets
*/
- if (setsockopt(fd_ptr->fd, SOL_SOCKET, SO_REUSEADDR, (sockopt_val_t) & turnon,
+ if (setsockopt(fd_ptr->fd, SOL_SOCKET, SO_REUSEADDR, (sockopt_val_t)&turnon,
sizeof(turnon)) < 0) {
berrno be;
Emsg1(M_WARNING, 0, _("Cannot set SO_REUSEADDR on socket: %s\n"),
/*
* Receive notification when connection dies.
*/
- if (setsockopt(newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t) & turnon,
+ if (setsockopt(newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon,
sizeof(turnon)) < 0) {
berrno be;
Emsg1(M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
/*
* Reuse old sockets
*/
- if (setsockopt
- (sockfd, SOL_SOCKET, SO_REUSEADDR, (sockopt_val_t) & turnon,
- sizeof(turnon)) < 0) {
+ if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
Emsg1(M_WARNING, 0, _("Cannot set SO_REUSEADDR on socket: %s\n"),
strerror(errno));
}
/*
* Receive notification when connection dies.
*/
- if (setsockopt
- (newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t) & turnon,
- sizeof(turnon)) < 0) {
+ if (setsockopt(newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
Emsg1(M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
strerror(errno));
}
#include "stored.h"
/* Forward referenced functions */
+void set_os_device_parameters(DEVICE *dev);
/*
* Allocate and initialize the DEVICE structure
return -1;
}
archive_name = get_pool_memory(PM_FNAME);
- pm_strcpy(&archive_name, dev->dev_name);
+ pm_strcpy(archive_name, dev->dev_name);
if (archive_name[strlen(archive_name)] != '/') {
- pm_strcat(&archive_name, "/");
+ pm_strcat(archive_name, "/");
}
pm_strcat(&archive_name, VolName);
Dmsg1(29, "open_dev: device is disk %s\n", archive_name);
dev->state |= ST_OPENED;
dev->use_count = 1;
update_pos_dev(dev); /* update position */
+ set_os_device_parameters(dev); /* do system dependent stuff */
}
Dmsg1(29, "open_dev: disk fd=%d opened\n", dev->fd);
free_pool_memory(archive_name);
ioctl(dev->fd, MTIOCERRSTAT, (char *)&mt_errstat);
}
#endif
+
+/* Clear Subsystem Exception OSF1 */
+#ifdef MTCSE
+{
+ struct mtop mt_com;
+ mt_com.mt_op = MTCSE;
+ mt_com.mt_count = 1;
+ /* Clear any error condition on the tape */
+ ioctl(dev->fd, MTIOCTOP, (char *)&mt_com);
+ Dmsg0(200, "Did MTCSE\n");
+}
+#endif
}
/*
return false;
}
return true;
+}
+
+void set_os_device_parameters(DEVICE *dev)
+{
+#ifdef HAVE_LINUX_OS
+ struct mtop mt_com;
+ if (dev->min_block_size == dev->max_block_size &&
+ dev->min_block_size == 0) { /* variable block mode */
+ mt_com.mt_op = MTSETBLK;
+ mt_com.mt_count = 0;
+ if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
+ clrerror_dev(dev, MTSETBLK);
+ }
+ mt_com.mt_op = MTSETDRVBUFFER;
+ mt_com.mt_count = MT_ST_CLEARBOOLEANS;
+ if (!dev_cap(dev, CAP_TWOEOF)) {
+ mt_com.mt_count |= MT_ST_TWO_FM;
+ }
+ if (dev_cap(dev, CAP_EOM)) {
+ mt_com.mt_count |= MT_ST_FAST_MTEOM;
+ }
+ if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
+ clrerror_dev(dev, MTSETBLK);
+ }
+ }
+ return;
+#endif
+
+#ifdef HAVE_NETBSD_OS
+ struct mtop mt_com;
+ if (dev->min_block_size == dev->max_block_size &&
+ dev->min_block_size == 0) { /* variable block mode */
+ mt_com.mt_op = MTSETBSIZ;
+ mt_com.mt_count = 0;
+ if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
+ clrerror_dev(dev, MTSETBSIZ);
+ }
+ /* Get notified at logical end of tape */
+ mt_com.mt_op = MTEWARN;
+ mt_com.mt_count = 1;
+ if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
+ clrerror_dev(dev, MTEWARN);
+ }
+ }
+ return;
+#endif
+
+#if HAVE_FREEBSD_OS || HAVE_OPENBSD_OS
+ struct mtop mt_com;
+ if (dev->min_block_size == dev->max_block_size &&
+ dev->min_block_size == 0) { /* variable block mode */
+ mt_com.mt_op = MTSETBSIZ;
+ mt_com.mt_count = 0;
+ if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
+ clrerror_dev(dev, MTSETBSIZ);
+ }
+ }
+ return;
+#endif
+
+#ifdef HAVE_SUN_OS
+ struct mtop mt_com;
+ if (dev->min_block_size == dev->max_block_size &&
+ dev->min_block_size == 0) { /* variable block mode */
+ mt_com.mt_op = MTSRSZ;
+ mt_com.mt_count = 0;
+ if (ioctl(dev->fd, MTIOCTOP, (char *)&mt_com) < 0) {
+ clrerror_dev(dev, MTSRSZ);
+ }
+ }
+ return;
+#endif
+
+
+
+
+
}
/* */
#undef VERSION
#define VERSION "1.35.5"
-#define BDATE "24 September 2004"
-#define LSMDATE "24Sep04"
+#define BDATE "25 September 2004"
+#define LSMDATE "25Sep04"
/* Debug flags */
#undef DEBUG