[BusyBox-cvs] busybox/coreutils tail.c, 1.45, 1.46 Config.in, 1.18, 1.19
Glenn McGrath
bug1 at busybox.net
Fri Oct 31 00:36:02 UTC 2003
Update of /var/cvs/busybox/coreutils
In directory winder:/tmp/cvs-serv24138/coreutils
Modified Files:
tail.c Config.in
Log Message:
Move the tail -c option from FANCY_TAIL to the default tail, this makes
the default tail options conform to SUSv3, with the non-SUS
option all in FANCY_TAIL
Index: tail.c
===================================================================
RCS file: /var/cvs/busybox/coreutils/tail.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- tail.c 28 Mar 2003 16:54:14 -0000 1.45
+++ tail.c 31 Oct 2003 00:35:58 -0000 1.46
@@ -89,9 +89,9 @@
}
static const char tail_opts[] =
- "fn:"
+ "fn:c:"
#ifdef CONFIG_FEATURE_FANCY_TAIL
- "c:qs:v"
+ "qs:v"
#endif
;
@@ -104,9 +104,7 @@
int from_top = 0;
int follow = 0;
int header_threshhold = 1;
-#ifdef CONFIG_FEATURE_FANCY_TAIL
int count_bytes = 0;
-#endif
char *tailbuf;
size_t tailbufsize;
@@ -132,11 +130,9 @@
case 'f':
follow = 1;
break;
-#ifdef CONFIG_FEATURE_FANCY_TAIL
case 'c':
count_bytes = 1;
/* FALLS THROUGH */
-#endif
case 'n':
GET_COUNT:
count = bb_xgetlarg10_sfx(optarg, tail_suffixes);
@@ -201,7 +197,7 @@
}
tailbufsize = BUFSIZ;
-#ifdef CONFIG_FEATURE_FANCY_TAIL
+
/* tail the files */
if (from_top < count_bytes) { /* Each is 0 or 1, so true iff 0 < 1. */
/* Hence, !from_top && count_bytes */
@@ -209,7 +205,7 @@
tailbufsize = count + BUFSIZ;
}
}
-#endif
+
buf = tailbuf = xmalloc(tailbufsize);
fmt = header_fmt + 1; /* Skip header leading newline on first output. */
@@ -237,13 +233,10 @@
if (from_top) {
nwrite = nread;
if (seen < count) {
-#ifdef CONFIG_FEATURE_FANCY_TAIL
if (count_bytes) {
nwrite -= (count - seen);
seen = count;
- } else
-#endif
- {
+ } else {
s = buf;
do {
--nwrite;
@@ -255,16 +248,13 @@
}
tail_xbb_full_write(buf + nread - nwrite, nwrite);
} else if (count) {
-#ifdef CONFIG_FEATURE_FANCY_TAIL
if (count_bytes) {
taillen += nread;
if (taillen > count) {
memmove(tailbuf, tailbuf + taillen - count, count);
taillen = count;
}
- } else
-#endif
- {
+ } else {
int k = nread;
int nbuf = 0;
Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/coreutils/Config.in,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- Config.in 31 Oct 2003 00:04:24 -0000 1.18
+++ Config.in 31 Oct 2003 00:35:59 -0000 1.19
@@ -420,11 +420,12 @@
from files.
config CONFIG_FEATURE_FANCY_TAIL
- bool " Enable extra tail options (-c, -q, -s, and -v)"
+ bool " Enable extra tail options (-q, -s, and -v)"
default y
depends on CONFIG_TAIL
help
- Enable tail options (-c, -q, -s, and -v).
+ The options (-q, -s, and -v) are provided by GNU tail, but
+ are not specific in the SUSv3 standard.
config CONFIG_TEE
bool "tee"
More information about the busybox-cvs
mailing list