This patch elimates a FIXME: adding fractional-second sleep intervals for the "tail -f" command.
The following diff is against the tail.c in the textutils package of Debian woody, but it is probably not too different from the GNU original. -- Erik Rossen ^ OpenPGP key: 2935D0B9 [EMAIL PROTECTED] /e\ "Use GnuPG, see the http://www.multimania.com/rossen --- black helicopters."
--- tail.c Thu Apr 11 21:05:28 2002
+++ tail.c.NEW Thu Apr 11 21:06:39 2002
@@ -170,8 +170,8 @@
/* The number of seconds to sleep between iterations.
During one iteration, every file name or descriptor is checked to
see if it has changed. */
-/* FIXME: allow fractional seconds */
-static unsigned int sleep_interval = 1;
+/* sleep interval defaults to 1,000,000 microseconds */
+static unsigned long sleep_interval = 1000000;
/* The process ID of the process (presumably on the current host)
that is writing to all followed files. */
@@ -921,7 +921,7 @@
{
if (writer_is_dead)
break;
- sleep (sleep_interval);
+ usleep (sleep_interval);
/* Once the writer is dead, read the files once more to
avoid a race condition. */
@@ -1408,14 +1408,14 @@
case 's':
{
strtol_error s_err;
- unsigned long int tmp_ulong;
- s_err = xstrtoul (optarg, NULL, 10, &tmp_ulong, "");
- if (s_err != LONGINT_OK || tmp_ulong > UINT_MAX)
+ double tmp_d;
+ s_err = xstrtod (optarg, NULL, &tmp_d);
+ if (s_err != LONGINT_OK || (unsigned long) (tmp_d*1000000.0) > UINT_MAX)
{
error (EXIT_FAILURE, 0,
_("%s: invalid number of seconds"), optarg);
}
- sleep_interval = tmp_ulong;
+ sleep_interval = (unsigned long) (tmp_d*1000000.0);
}
break;
msg00772/pgp00000.pgp
Description: PGP signature
