]> andersk Git - moira.git/blobdiff - update/update_server.c
fixed header again - tom
[moira.git] / update / update_server.c
index c892773bdc0f7f96acba12832dd1d8c87d5fa808..54c162e1a866e8ff6b41238e7088b6fb50825321 100644 (file)
@@ -14,21 +14,28 @@ static char *rcsid_dispatch_c = "$Header$";
 #include <stdio.h>
 #include <gdb.h>
 #include <errno.h>
-#include <strings.h>
+#include <string.h>
 #include <pwd.h>
 #include <moira.h>
 #include <sys/file.h>
+#include <fcntl.h>
 #include <sys/ioctl.h>
+#ifdef POSIX
+#include <termios.h>
+#endif
 #include "update.h"
 
 extern int auth_001(), inst_001();
-extern int xfer_002(), exec_002();
+extern int xfer_002(), xfer_003(), exec_002();
 
 extern int sync_proc(), quit();
 extern char *config_lookup();
 
 extern void gdb_debug();
-extern int exit(), abort(), errno;
+extern int abort(), errno;
+#ifndef sun
+extern int exit();
+#endif
 extern STRING instructions;
 
 CONNECTION conn;
@@ -52,6 +59,7 @@ struct _dt {
      { "INST_001", inst_001 },
      { "AUTH_001", auth_001 },
      { "XFER_002", xfer_002 },
+     { "XFER_003", xfer_003 },
      { "EXEC_002", exec_002 },
      { "quit", quit },
      { (char *)NULL, abort }
@@ -74,7 +82,7 @@ main(argc, argv)
      gdb_debug(GDB_NOFORK);
 #endif /* DEBUG */
 
-     whoami = rindex(argv[0], '/');
+     whoami = strrchr(argv[0], '/');
      if (whoami)
         whoami++;
      else
@@ -90,11 +98,15 @@ main(argc, argv)
      if (!config_lookup("nofork")) {
         if (fork())
           exit(0);
+#ifdef POSIX
+        setsid();
+#else
         n = open("/dev/tty", O_RDWR|FNDELAY);
         if (n > 0) {
             (void) ioctl(n, TIOCNOTTY, (char *)NULL);
             (void) close(n);
         }
+#endif
      } else
        gdb_debug(GDB_NOFORK);
 #endif
@@ -155,7 +167,7 @@ main(argc, argv)
              sever_connection(conn);
              exit(1);
          }
-         cp = index(STRING_DATA(str), ' ');
+         cp = strchr(STRING_DATA(str), ' ');
          if (cp)
               *cp = '\0';
          for (d = dispatch_table; d->str; d++) {
@@ -220,7 +232,7 @@ quit(str)
      (void) send_ok();
      sever_connection(conn);
      mr_log_info("Closing connection.");
-     exit(0);
+     return(exit(0));
 }
 
 
This page took 0.036833 seconds and 4 git commands to generate.