summaryrefslogtreecommitdiff
path: root/sysutils/gnome2-system-monitor/patches/patch-aa
blob: 60a66e4583c42b5675437be8a6fa1dbc83e440cb (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
$NetBSD: patch-aa,v 1.2 2004/04/01 19:08:26 jmmv Exp $

http://bugzilla.gnome.org/show_bug.cgi?id=129176

Index: configure.in
===================================================================
RCS file: /cvs/gnome/procman/configure.in,v
retrieving revision 1.101
diff -u -r1.101 configure.in
--- configure.in	15 Feb 2004 19:43:59 -0000	1.101
+++ configure.in	19 Feb 2004 12:17:40 -0000
@@ -6,11 +6,22 @@
 
 AC_PROG_INTLTOOL
 
+AC_CANONICAL_HOST
 AC_ISC_POSIX
 AC_PROG_CC
 AM_PROG_CC_STDC
 AC_HEADER_STDC
 GNOME_COMPILE_WARNINGS
+
+# Some systems need special libraries to get pty functions.
+case "${host}" in
+    *netbsd*)
+        LIBS="${LIBS} -lutil"
+        ;;
+    *)
+        ;;
+esac
+AC_CHECK_FUNCS(getpt grantpt ptsname unlockpt)
 
 LIBGNOME_REQUIRED=2.0.0
 LIBGNOMEUI_REQUIRED=2.0.0
Index: src/util.c
===================================================================
RCS file: /cvs/gnome/procman/src/util.c,v
retrieving revision 1.16
diff -u -r1.16 util.c
--- src/util.c	2 Jan 2004 17:02:45 -0000	1.16
+++ src/util.c	19 Feb 2004 12:17:40 -0000
@@ -16,7 +16,10 @@
 
 #ifdef __FreeBSD__
 # include <errno.h>
+# include <termios.h>
 # include <libutil.h>
+#elif defined(__NetBSD__)
+# include <util.h>
 #endif
 
 #ifdef __sun
@@ -49,8 +52,9 @@
  */
 #define OPEN_TTY() getpt()
 
-#ifdef __FreeBSD__
-/* FreeBSD doesn't have getpt(). This function emulates it's behaviour. */
+#if !defined(HAVE_GETPT) && (defined(__FreeBSD__) || defined(__NetBSD__))
+/* FreeBSD and NetBSD don't have getpt(). This function emulates its
+   behaviour. */
 int getpt (void);
 
 int
@@ -68,6 +72,7 @@
 #endif
 
 #ifdef __sun
+#if !defined(HAVE_GETPT)
 /* Sun doesn't have getpt().  This function emulates it's behavior. */
 int getpt (void);
 
@@ -113,6 +118,7 @@
 
 	return fds;
 }
+#endif
 
 /* Handle the fact that solaris doesn't have an asprintf */
 /* pinched from 
@@ -181,7 +187,14 @@
 	 * Make su think we're sending the password from a terminal:
 	 */
 
-	if (((t_fd = OPEN_TTY()) < 0) || (grantpt(t_fd) < 0) || (unlockpt(t_fd) < 0)) {
+	if (((t_fd = OPEN_TTY()) < 0)
+#ifdef HAVE_GRANTPT
+            || (grantpt(t_fd) < 0)
+#endif
+#ifdef HAVE_UNLOCKPT
+            || (unlockpt(t_fd) < 0)
+#endif
+            ) {
 		fprintf (stderr, "Unable to open a terminal\n");
 		ABORT (root);
 	}
@@ -259,7 +272,11 @@
 			}
 		}
 
-		if(((pts = ptsname(t_fd)) == NULL) || ((t_fd = open(pts, O_RDWR | O_NOCTTY)) < 0)) {
+#ifdef HAVE_PTSNAME
+		if (((pts = ptsname(t_fd)) == NULL) || ((t_fd = open(pts, O_RDWR | O_NOCTTY)) < 0)) {
+#else
+		if (((pts = ttyname(t_fd)) == NULL) || ((t_fd = open(pts, O_RDWR | O_NOCTTY)) < 0)) {
+#endif
 			perror ("Unable to open pseudo slave terminal");
 			_exit (-1);
 		}