1 --- rxvt-2.7.10/autoconf/Make.common.in.orig Fri Mar 28 06:34:40 2003
2 +++ rxvt-2.7.10/autoconf/Make.common.in Fri Mar 28 06:35:12 2003
6 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEBUG) $(DINCLUDE) $(XINC) -I$(basedir) -I$(srcdir) -I.
7 -LINK = $(CC) $(CFLAGS) $(LDFLAGS)
8 +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -lutempter -lutil
10 # End of common section of the Makefile
11 #-------------------------------------------------------------------------
12 --- rxvt-2.7.10/src/logging.c.orig Fri Mar 28 06:31:43 2003
13 +++ rxvt-2.7.10/src/logging.c Fri Mar 28 06:33:37 2003
16 rxvt_makeutent(rxvt_t *r, const char *pty, const char *hostname)
18 -#ifdef HAVE_STRUCT_UTMP
19 - struct utmp *ut = &(r->h->ut);
21 -#ifdef HAVE_STRUCT_UTMPX
22 - struct utmpx *utx = &(r->h->utx);
28 - struct passwd *pwent = getpwuid(getuid());
30 - if (!STRNCMP(pty, "/dev/", 5))
31 - pty += 5; /* skip /dev/ prefix */
33 - if (!STRNCMP(pty, "pty", 3) || !STRNCMP(pty, "tty", 3)) {
34 - STRNCPY(ut_id, (pty + 3), sizeof(ut_id));
37 - else if (sscanf(pty, "pts/%d", &i) == 1)
38 - sprintf(ut_id, "vt%02x", (i & 0xff)); /* sysv naming */
40 - else if (STRNCMP(pty, "pty", 3) && STRNCMP(pty, "tty", 3)) {
41 - rxvt_print_error("can't parse tty name \"%s\"", pty);
45 -#ifdef HAVE_STRUCT_UTMP
46 - MEMSET(ut, 0, sizeof(struct utmp));
47 -# ifdef HAVE_UTMP_PID
49 - STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id));
50 - ut->ut_type = DEAD_PROCESS;
51 - getutid(ut); /* position to entry in utmp file */
52 - STRNCPY(r->h->ut_id, ut_id, sizeof(r->h->ut_id));
56 -#ifdef HAVE_STRUCT_UTMPX
57 - MEMSET(utx, 0, sizeof(struct utmpx));
59 - STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id));
60 - utx->ut_type = DEAD_PROCESS;
61 - getutxid(utx); /* position to entry in utmp file */
62 - STRNCPY(r->h->ut_id, ut_id, sizeof(r->h->ut_id));
65 -#ifdef HAVE_STRUCT_UTMP
66 - STRNCPY(ut->ut_line, pty, sizeof(ut->ut_line));
67 - ut->ut_time = time(NULL);
68 -# ifdef HAVE_UTMP_PID
69 - STRNCPY(ut->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
70 - sizeof(ut->ut_user));
71 - STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id));
72 - ut->ut_time = time(NULL);
73 - ut->ut_pid = r->h->cmd_pid;
74 -# ifdef HAVE_UTMP_HOST
75 - STRNCPY(ut->ut_host, hostname, sizeof(ut->ut_host));
77 - ut->ut_type = USER_PROCESS;
79 - endutent(); /* close the file */
80 - r->h->utmp_pos = -1;
82 - STRNCPY(ut->ut_name, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
83 - sizeof(ut->ut_name));
84 -# ifdef HAVE_UTMP_HOST
85 - STRNCPY(ut->ut_host, hostname, sizeof(ut->ut_host));
90 -#ifdef HAVE_STRUCT_UTMPX
91 - STRNCPY(utx->ut_line, pty, sizeof(utx->ut_line));
92 - STRNCPY(utx->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
93 - sizeof(utx->ut_user));
94 - STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id));
95 - utx->ut_session = getsid(0);
96 - utx->ut_tv.tv_sec = time(NULL);
97 - utx->ut_tv.tv_usec = 0;
98 - utx->ut_pid = r->h->cmd_pid;
99 -# ifdef HAVE_UTMPX_HOST
100 - STRNCPY(utx->ut_host, hostname, sizeof(utx->ut_host));
105 - if ((colon = STRRCHR(ut->ut_host, ':')) != NULL)
110 - utx->ut_type = USER_PROCESS;
112 - endutxent(); /* close the file */
113 - r->h->utmp_pos = -1;
116 -#if defined(HAVE_STRUCT_UTMP) && !defined(HAVE_UTMP_PID)
119 -# ifdef HAVE_TTYSLOT
121 - if (rxvt_write_bsd_utmp(i, ut))
122 - r->h->utmp_pos = i;
126 - if ((fd0 = fopen(TTYTAB_FILENAME, "r")) != NULL) {
127 - char buf[256], name[256];
129 - buf[sizeof(buf) - 1] = '\0';
130 - for (i = 1; (fgets(buf, sizeof(buf) - 1, fd0) != NULL);) {
131 - if (*buf == '#' || sscanf(buf, "%s", name) != 1)
133 - if (!STRCMP(ut->ut_line, name)) {
134 - if (!rxvt_write_bsd_utmp(i, ut))
136 - r->h->utmp_pos = i;
149 -# ifdef WTMP_ONLY_ON_LOGIN
150 - if (r->Options & Opt_loginShell)
153 -# ifdef HAVE_STRUCT_UTMP
154 -# ifdef HAVE_UPDWTMP
155 - updwtmp(RXVT_WTMP_FILE, ut);
157 - rxvt_update_wtmp(RXVT_WTMP_FILE, ut);
160 -# ifdef HAVE_STRUCT_UTMPX
161 - updwtmpx(RXVT_WTMPX_FILE, utx);
165 -#if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE)
166 - if (r->Options & Opt_loginShell)
167 - rxvt_update_lastlog(RXVT_LASTLOG_FILE, pty, hostname);
169 + addToUtmp(pty, NULL, r->cmd_fd);
172 /* ------------------------------------------------------------------------- */
175 rxvt_cleanutent(rxvt_t *r)
177 -#ifdef HAVE_STRUCT_UTMP
178 - struct utmp *tmput, *ut = &(r->h->ut);
180 -#ifdef HAVE_STRUCT_UTMPX
181 - struct utmpx *tmputx, *utx = &(r->h->utx);
184 -#ifdef HAVE_STRUCT_UTMP
185 -# ifdef HAVE_UTMP_PID
186 - MEMSET(ut, 0, sizeof(struct utmp));
188 - STRNCPY(ut->ut_id, r->h->ut_id, sizeof(ut->ut_id));
189 - ut->ut_type = USER_PROCESS;
190 - if ((tmput = getutid(ut))) /* position to entry in utmp file */
192 - ut->ut_type = DEAD_PROCESS;
194 - MEMSET(ut->ut_name, 0, sizeof(ut->ut_name));
195 -# ifdef HAVE_UTMP_HOST
196 - MEMSET(ut->ut_host, 0, sizeof(ut->ut_host));
199 - ut->ut_time = time(NULL);
202 -#ifdef HAVE_STRUCT_UTMPX
203 - MEMSET(utx, 0, sizeof(struct utmpx));
205 - STRNCPY(utx->ut_id, r->h->ut_id, sizeof(utx->ut_id));
206 - utx->ut_type = USER_PROCESS;
207 - if ((tmputx = getutxid(utx))) /* position to entry in utmp file */
209 - utx->ut_type = DEAD_PROCESS;
210 - utx->ut_session = getsid(0);
211 - utx->ut_tv.tv_sec = time(NULL);
212 - utx->ut_tv.tv_usec = 0;
216 - * Write ending wtmp entry
219 -# ifdef WTMP_ONLY_ON_LOGIN
220 - if (r->Options & Opt_loginShell)
223 -# ifdef HAVE_STRUCT_UTMP
224 -# ifdef HAVE_UPDWTMP
225 - updwtmp(RXVT_WTMP_FILE, ut);
227 - rxvt_update_wtmp(RXVT_WTMP_FILE, ut);
230 -# ifdef HAVE_STRUCT_UTMPX
231 - updwtmpx(RXVT_WTMPX_FILE, utx);
239 -#ifdef HAVE_STRUCT_UTMP
240 -# ifdef HAVE_UTMP_PID
241 - if (ut->ut_pid == r->h->cmd_pid)
245 - if (r->h->utmp_pos > 0) {
246 - MEMSET(ut, 0, sizeof(struct utmp));
247 - rxvt_write_bsd_utmp(r->h->utmp_pos, ut);
251 -#ifdef HAVE_STRUCT_UTMPX
252 - if (utx->ut_pid == r->h->cmd_pid)
259 /* ------------------------------------------------------------------------- */