1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
$NetBSD: patch-cj,v 1.1 2001/12/20 09:20:03 tron Exp $
--- lib/libxview/ttysw/tty_init.c.orig Tue Jun 29 07:17:19 1993
+++ lib/libxview/ttysw/tty_init.c Thu Dec 20 10:09:17 2001
@@ -14,6 +14,7 @@
* 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 @@
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 @@
extern int ttysel_use_seln_service;
+static int ttyinit();
struct ttysw_createoptions {
int becomeconsole; /* be the console */
@@ -518,6 +524,9 @@
(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 @@
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 @@
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);
|