PERFORCE change 129712 for review

Peter Wemm peter at FreeBSD.org
Wed Nov 28 11:04:03 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=129712

Change 129712 by peter at peter_overcee on 2007/11/28 19:03:22

	Hack to allow tail to force line buffering (-l flag) even when
	stdout is a pipe.  Useful for 'tail -f logfile | grep foo'

Affected files ...

.. //depot/projects/hammer/usr.bin/tail/tail.c#6 edit

Differences ...

==== //depot/projects/hammer/usr.bin/tail/tail.c#6 (text+ko) ====

@@ -115,7 +115,7 @@
 	obsolete(argv);
 	style = NOTSET;
 	off = 0;
-	while ((ch = getopt(argc, argv, "Fb:c:fn:qr")) != -1)
+	while ((ch = getopt(argc, argv, "Fb:c:fln:qr")) != -1)
 		switch(ch) {
 		case 'F':	/* -F is superset of (and implies) -f */
 			Fflag = fflag = 1;
@@ -129,6 +129,9 @@
 		case 'f':
 			fflag = 1;
 			break;
+		case 'l':
+			setlinebuf(stdout);
+			break;
 		case 'n':
 			ARG(1, FLINES, RLINES);
 			break;


More information about the p4-projects mailing list