#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;
{ "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 }
gdb_debug(GDB_NOFORK);
#endif /* DEBUG */
- whoami = rindex(argv[0], '/');
+ whoami = strrchr(argv[0], '/');
if (whoami)
whoami++;
else
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
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++) {
(void) send_ok();
sever_connection(conn);
mr_log_info("Closing connection.");
- exit(0);
+ return(exit(0));
}