76 lines
2.2 KiB
Plaintext
76 lines
2.2 KiB
Plaintext
--- lib/libxview/ttysw/tty_init.c.orig 1993-06-29 07:17:19.000000000 +0200
|
|
+++ lib/libxview/ttysw/tty_init.c 2003-12-30 01:31:14.000000000 +0100
|
|
@@ -14,6 +14,7 @@ static char sccsid[] = "@(#)tty_init
|
|
* Ttysw initialization, destruction and error procedures
|
|
*/
|
|
|
|
+#include <sys/param.h>
|
|
#include <sys/time.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
@@ -82,7 +83,11 @@ static char sccsid[] = "@(#)tty_init
|
|
|
|
extern char *strncpy();
|
|
extern char *strcpy();
|
|
+#if (defined(BSD) && (BSD >= 199306))
|
|
+extern off_t lseek();
|
|
+#else
|
|
extern long lseek();
|
|
+#endif
|
|
char *textsw_checkpoint_undo();
|
|
|
|
/* static */ void ttysw_parseargs();
|
|
@@ -106,6 +111,7 @@ Xv_private char *xv_font_monospace();
|
|
|
|
extern int ttysel_use_seln_service;
|
|
|
|
+static int ttyinit();
|
|
|
|
struct ttysw_createoptions {
|
|
int becomeconsole; /* be the console */
|
|
@@ -518,6 +524,9 @@ ttysw_fork_it(ttysw0, argv, wfd)
|
|
(void) dup2(ttysw->ttysw_tty, 2);
|
|
(void) close(ttysw->ttysw_tty);
|
|
|
|
+#if (defined(BSD) && (BSD >= 199103))
|
|
+ (void) ioctl(0, TIOCSCTTY, NULL);
|
|
+#endif
|
|
if (*argv == (char *) NULL || strcmp("-c", *argv) == 0) {
|
|
/* Process arg list */
|
|
int argc;
|
|
@@ -955,7 +964,11 @@ updateutmp(username, ttyslotuse, ttyfd)
|
|
struct utmpx utmp;
|
|
#endif
|
|
struct passwd *passwdent;
|
|
+#if !(defined(BSD) && (BSD >= 199103))
|
|
extern struct passwd *getpwuid();
|
|
+#else
|
|
+ struct passwd *getpwuid __P((uid_t));
|
|
+#endif
|
|
int f;
|
|
char *ttyn;
|
|
extern char *ttyname();
|
|
@@ -1007,13 +1020,22 @@ updateutmp(username, ttyslotuse, ttyfd)
|
|
XV_MSG("Add tty[qrs][0-f] to /etc/ttys file.\n"));
|
|
return (0);
|
|
}
|
|
+#if !(defined(BSD) && (BSD >= 199103))
|
|
if ((f = open("/etc/utmp", 1)) >= 0) {
|
|
+#else
|
|
+ if ((f = open(_PATH_UTMP, 1)) >= 0) {
|
|
+#endif
|
|
(void) lseek(f, (long) (ttyslotuse * sizeof(utmp)), 0);
|
|
(void) write(f, (char *) &utmp, sizeof(utmp));
|
|
(void) close(f);
|
|
} else {
|
|
(void) fprintf(stderr,
|
|
+#if !(defined(BSD) && (BSD >= 199103))
|
|
XV_MSG("make sure that you can write /etc/utmp!\n"));
|
|
+#else
|
|
+ XV_MSG("make sure that you can write "));
|
|
+ (void) fprintf(stderr, "%s!\n", _PATH_UTMP);
|
|
+#endif
|
|
return (0);
|
|
}
|
|
return (ttyslotuse);
|