#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 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;
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++) {