On 31/01/2011 01:52, Larry Hall (Cygwin) wrote: > On 1/29/2011 8:20 AM, Angelo Graziosi wrote: >> I would ask if on Cygwin I can use the 'write' command: >> >> write - send a message to another user >> >> $ write USER [ttyname] >> >> I remember I have used it some years ago, but not remember if it was on >> GNU/Linux or Cygwin. >> >> I did a research on http://cygwin.com/packages and didn't find it, but >> perhaps I did the wrong search.. > > No, that's the correct place to search. If it's not showing up, none of > the current packages provide 'write'.
It's part of util-linux, but it's configured out of the build on Cygwin, because it relies on a working utmp file to operate. Which we don't have. Hmm, I'm in the middle of a gcc testrun right now and can't rebuild my DLL, but I noticed a few "interesting" points about the code: winsup/cygwin/include/utmpx.h > /* Must be kept in sync with struct utmp as defined in sys/utmp.h! */ > struct utmpx > { > short ut_type; > pid_t ut_pid; > char ut_line[UT_LINESIZE]; > char ut_id[UT_IDLEN]; > time_t ut_time; > char ut_user[UT_NAMESIZE]; > char ut_host[UT_HOSTSIZE]; > long ut_addr; > struct timeval ut_tv; > }; winsup/cygwin/include/sys/utmp.h > struct utmp > { > short ut_type; > pid_t ut_pid; > char ut_line[UT_LINESIZE]; > char ut_id[UT_IDLEN]; > time_t ut_time; > char ut_user[UT_NAMESIZE]; > char ut_host[UT_HOSTSIZE]; > long ut_addr; > }; That could explain why successive calls to getutent() appear to "lose frame" across the contents of utmp. Also, winsup/cygwin/syscalls.cc > /* Note: do not make NO_COPY */ > static struct utmp utmp_data_buf[16]; > static unsigned utix = 0; > #define nutdbuf (sizeof (utmp_data_buf) / sizeof (utmp_data_buf[0])) > #define utmp_data ({ \ > if (utix > nutdbuf) \ > utix = 0; \ > utmp_data_buf + utix++; \ > }) I haven't slept all night, but isn't that going to overrun by one? Anyway with the fix to utmp.h to add ut_tv (and a #include <sys/time.h>), write.exe compiles and works... cheers, DaveK -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple