SCCS-vsn: usr.bin/tail/tail.c 4.5
-static char *sccsid = "@(#)tail.c 4.4 (Berkeley) %G%";
+static char *sccsid = "@(#)tail.c 4.5 (Berkeley) %G%";
/* tail command
*
* tail where [file]
/* tail command
*
* tail where [file]
#include <sys/stat.h>
#include <errno.h>
#include <sys/stat.h>
#include <errno.h>
+#define LBIN 8193
+#undef BUFSIZ
+#define BUFSIZ LBIN-1
struct stat statb;
int follow;
int piped;
struct stat statb;
int follow;
int piped;
switch(*arg++) {
case 'b':
switch(*arg++) {
case 'b':
n <<= 9;
if(bylines!=-1) goto errcom;
bylines=0;
n <<= 9;
if(bylines!=-1) goto errcom;
bylines=0;
fexit();
if(!piped) {
fstat(0,&statb);
fexit();
if(!piped) {
fstat(0,&statb);
- di = !bylines&&n<LBIN?n:LBIN-1;
+ /* If by lines, back up 1 buffer: else back up as needed */
+ di = bylines?BUFSIZ:n;
if(statb.st_size > di)
lseek(0,-di,2);
if(!bylines)
if(statb.st_size > di)
lseek(0,-di,2);
if(!bylines)