svn commit: branches/busybox_scratch/coreutils
aldot at busybox.net
aldot at busybox.net
Sun Aug 20 11:33:09 UTC 2006
Author: aldot
Date: 2006-08-20 04:33:09 -0700 (Sun, 20 Aug 2006)
New Revision: 15842
Log:
- make the use of dprintf optional
(I admit that I *think* that this gave me some kind of error, somewhere, but I don't remember the details, unfortunately. Whatever)
Modified:
branches/busybox_scratch/coreutils/tail.c
Changeset:
Modified: branches/busybox_scratch/coreutils/tail.c
===================================================================
--- branches/busybox_scratch/coreutils/tail.c 2006-08-20 11:27:08 UTC (rev 15841)
+++ branches/busybox_scratch/coreutils/tail.c 2006-08-20 11:33:09 UTC (rev 15842)
@@ -42,21 +42,25 @@
static int status;
-static void tail_xprint_header(const char *fmt, const char *filename)
+static void tail_xbb_full_write(const char *buf, size_t len)
{
- /* If we get an output error, there is really no sense in continuing. */
- if (dprintf(STDOUT_FILENO, fmt, filename) < 0) {
+ /* If we get a write error, there is really no sense in continuing. */
+ if (bb_full_write(STDOUT_FILENO, buf, len) < 0) {
bb_perror_nomsg_and_die();
}
}
-/* len should probably be size_t */
-static void tail_xbb_full_write(const char *buf, size_t len)
+static void tail_xprint_header(const char *fmt, const char *filename)
{
- /* If we get a write error, there is really no sense in continuing. */
- if (bb_full_write(STDOUT_FILENO, buf, len) < 0) {
+#if defined __GLIBC__
+ if (dprintf(STDOUT_FILENO, fmt, filename) < 0)
bb_perror_nomsg_and_die();
- }
+#else
+ int hdr_len = strlen(fmt) + strlen(filename);
+ char *hdr = xzalloc(hdr_len);
+ sprintf(hdr, filename, filename);
+ tail_xbb_full_write(hdr, hdr_len);
+#endif
}
static ssize_t tail_read(int fd, char *buf, size_t count)
More information about the busybox-cvs
mailing list