]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/console/console.c
Update doc
[bacula/bacula] / bacula / src / console / console.c
index 614951411754f432c660b06e794e292173aa19aa..d3f0fcd4e054fa00bd5568a754c1b76a87c8cbe7 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 Kern Sibbald and John Walker
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
 #define clrbrk()
 #define usrbrk() 0  
 #endif
+
+#ifdef HAVE_WIN32
+#include <windows.h>
+#define isatty(fd) (fd==0)
+DWORD  g_platform_id = VER_PLATFORM_WIN32_WINDOWS;
+#endif
  
 /* Exported variables */
 
@@ -288,7 +294,7 @@ int main(int argc, char *argv[])
 
    init_stack_dump();
    my_name_is(argc, argv, "bconsole");
-   textdomain("bacula-console");
+   textdomain("bacula");
    init_msg(NULL, NULL);
    working_directory = "/tmp";
    args = get_pool_memory(PM_FNAME);
@@ -332,13 +338,16 @@ int main(int argc, char *argv[])
       init_signals(terminate_console);
    }
 
+#if !defined(HAVE_WIN32)
    /* Override Bacula default signals */
    signal(SIGCHLD, SIG_IGN);
+   signal(SIGQUIT, SIG_IGN);
    signal(SIGTSTP, got_sigstop);
    signal(SIGCONT, got_sigcontinue);
    signal(SIGTTIN, got_sigtin);
    signal(SIGTTOU, got_sigtout);
    trapctlc();
+#endif
 
    if (argc) {
       usage();
@@ -372,6 +381,10 @@ Without that I don't how to speak to the Director :-(\n"), configfile);
    memset(&jcr, 0, sizeof(jcr));
 
 
+#ifdef HAVE_WIN32
+   WSA_Init();                       /* Initialize Windows sockets */
+#endif
+
    if (ndir > 1) {
       struct sockaddr_in client_addr;
       memset(&client_addr, 0, sizeof(client_addr));
@@ -510,6 +523,9 @@ wait_for_data(int fd, int sec)
 {
    fd_set fdset;
    struct timeval tv;
+#ifdef HAVE_WIN32
+   return 1;                          /* select doesn't seem to work on Win32 */
+#endif
 
    tv.tv_sec = sec;
    tv.tv_usec = 0;
@@ -722,6 +738,8 @@ void sendit(char *buf)
     if (tee) {
        fputs(buf, stdout);
     }
-    fflush(stdout);
+    if (output == stdout || tee) {
+       fflush(stdout);
+    }
 #endif
 }