Ken Hornstein writes:
Please don't remove rcvtty -- I use it too -- and on OpenBSD no less,
with a tiny patch that brings back utmp support (so few lines, was it
really necessary to remove it?).
Yes. We made a decision to migrate to POSIX,
I mentioned that utmpx is not required by POSIX, and you replied that it's
more complicated than that. Could you expand on that? I'm interested to
hear more, because I personally am not very familiar with this stuff.
and I wouldn't call the
amount of code removed small (look at the revision logs to see what I
mean). I'd call it a hairy mess, actually. Reworking that code to
support both utmp and utmpx wasn't something I was interested in doing,
especially when it's obvious where the world has gone.
The patch William mentioned adds only 15 lines; it's reproduced below.
Would you consider committing it?
--- uip/rcvtty.c.orig Mon Jun 11 00:06:19 2012
+++ uip/rcvtty.c Tue Jan 1 18:11:37 2013
@@ -24,6 +24,8 @@
#ifdef HAVE_GETUTXENT
#include <utmpx.h>
+#else
+#include <utmp.h>
#endif /* HAVE_GETUTXENT */
#define SCANFMT \
@@ -83,7 +85,12 @@ main (int argc, char **argv)
int md, vecp = 0;
char *cp, *user, buf[BUFSIZ], tty[BUFSIZ];
char **argp, **arguments, *vec[MAXARGS];
+#if HAVE_GETUTXENT
struct utmpx *utp;
+#else
+ struct utmp ut;
+ register FILE *uf;
+#endif
#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
@@ -169,6 +176,16 @@ main (int argc, char **argv)
}
}
endutxent();
+#else
+ if ((uf = fopen (_PATH_UTMP, "r")) == NULL)
+ exit (RCV_MBX);
+ while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1)
+ if (ut.ut_name[0] != 0
+ && strncmp (user, ut.ut_name, sizeof(ut.ut_name)) == 0) {
+ strncpy (tty, ut.ut_line, sizeof(ut.ut_line));
+ alert (tty, md);
+ }
+ fclose (uf);
#endif /* HAVE_GETUTXENT */
exit (RCV_MOK);
_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/nmh-workers