aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-02-05 01:04:19 +0800
committerjkim <jkim@FreeBSD.org>2010-02-05 01:04:19 +0800
commit68eb8354d3ec549a8b376544dff8813fc925b52b (patch)
treeea8ed86f7520fdef79406a803f5ef5864e655b0d
parent1c15d8a57812f8bd8e8f83cd048046788aa313ec (diff)
downloadfreebsd-ports-gnome-68eb8354d3ec549a8b376544dff8813fc925b52b.tar.gz
freebsd-ports-gnome-68eb8354d3ec549a8b376544dff8813fc925b52b.tar.zst
freebsd-ports-gnome-68eb8354d3ec549a8b376544dff8813fc925b52b.zip
Fix build on CURRENT using utmpx.h instead of now defunct utmp.h.
Approved by: nrg milk (bsdports at mail dot com) (maintainer)
-rw-r--r--sysutils/jfbterm/files/patch-utmpx95
1 files changed, 95 insertions, 0 deletions
diff --git a/sysutils/jfbterm/files/patch-utmpx b/sysutils/jfbterm/files/patch-utmpx
new file mode 100644
index 000000000000..e385e17c1e8d
--- /dev/null
+++ b/sysutils/jfbterm/files/patch-utmpx
@@ -0,0 +1,95 @@
+--- term.c.orig 2009-02-07 12:30:17.000000000 -0500
++++ term.c 2010-01-28 13:40:25.000000000 -0500
+@@ -59,7 +59,11 @@
+ #include <termios.h>
+ #include <time.h>
+ #include <unistd.h>
++#ifdef HAVE_UTMP_H
+ #include <utmp.h>
++#else
++#include <utmpx.h>
++#endif
+
+ #if defined (__linux__)
+ #include <sys/vt.h>
+@@ -523,6 +527,41 @@ static void writeLoginRecord(void)
+ pututline(&utmp);
+ endutent();
+ privilege_off();
++#elif defined (__FreeBSD__) && (__FreeBSD_version >= 900007)
++ struct utmpx utmp;
++ struct passwd *pw;
++ char *tn;
++
++ assert(initialized);
++
++ bzero(&utmp, sizeof(utmp));
++ pw = getpwuid(privilege_getUID());
++ if (pw == NULL) {
++ warnx("who are you?");
++ return; /* give up */
++ }
++ if (strncmp(self->device, "/dev/pts/", 9) == 0 ||
++ strncmp(self->device, "/dev/tty", 8) == 0) {
++ /* Unix98 style: "/dev/pts/\*" */
++ /* BSD style: "/dev/tty[l-sL-S][0-9a-v]" */
++ tn = self->device + strlen("/dev/");
++ if (strlen(tn) < 5)
++ return; /* bad format */
++ strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id));
++ } else
++ return; /* bad format */
++ utmp.ut_type = DEAD_PROCESS;
++ privilege_on();
++ setutxent();
++ getutxid(&utmp);
++ utmp.ut_type = USER_PROCESS;
++ utmp.ut_pid = getpid();
++ strncpy(utmp.ut_line, tn, sizeof(utmp.ut_line));
++ strncpy(utmp.ut_user, pw->pw_name, sizeof(utmp.ut_user));
++ gettimeofday(&(utmp.ut_tv), NULL);
++ pututxline(&utmp);
++ endutxent();
++ privilege_off();
+ #elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__)
+ struct utmp utmp;
+ struct passwd *pw;
+@@ -600,6 +639,38 @@ static void eraseLoginRecord(void)
+ pututline(utp);
+ endutent();
+ privilege_off();
++#elif defined (__FreeBSD__) && (__FreeBSD_version >= 900007)
++ struct utmpx utmp, *utp;
++ char *tn;
++
++ assert(initialized);
++
++ bzero(&utmp, sizeof(utmp));
++ if (strncmp(self->device, "/dev/pts/", 9) == 0 ||
++ strncmp(self->device, "/dev/tty", 8) == 0) {
++ /* Unix98 style: "/dev/pts/\*" */
++ /* BSD style: "/dev/tty[l-sL-S][0-9a-v]" */
++ tn = self->device + strlen("/dev/");
++ if (strlen(tn) < 5)
++ return; /* bad format */
++ strncpy(utmp.ut_id, tn, sizeof(utmp.ut_id));
++ } else
++ return; /* bad format */
++ utmp.ut_type = USER_PROCESS;
++ privilege_on();
++ setutxent();
++ utp = getutxid(&utmp);
++ if (utp == NULL) {
++ endutxent();
++ privilege_off();
++ return; /* give up */
++ }
++ utp->ut_type = DEAD_PROCESS;
++ bzero(utp->ut_user, sizeof(utmp.ut_user));
++ gettimeofday(&(utp->ut_tv), NULL);
++ pututxline(utp);
++ endutxent();
++ privilege_off();
+ #elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__)
+ struct utmp utmp;
+ char *tn;