aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tail
Commit message (Collapse)AuthorAgeFilesLines
* Fix build of usr.bin/tail with GCCAlan Somers2017-01-111-7/+11
| | | | | | | | | | | Submitted by: pluknet Reported by: pluknet MFC after: 27 days X-MFC-with: 311895 Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=311928
* Fix memory leaks during "tail -r" of an irregular fileAlan Somers2017-01-104-77/+309
| | | | | | | | | | | | | | | | | * Rewrite r_buf to use standard tail queues instead of a hand-rolled circular linked list. Free dynamic allocations when done. * Remove an optimization for the case where the file is a multiple of 128KB in size and there is a scarcity of memory. * Add ATF tests for "tail -r" and its variants. Reported by: Valgrind Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9067 Notes: svn path=/head/; revision=311895
* Misc Coverity fixes for tail(1)Alan Somers2017-01-041-1/+8
| | | | | | | | | | | | | CID 1006402: Initialize stack variable CID 271580: Don't leak memory when ENOMEM. Reported by: Coverity CID: 271580 1006402 MFC after: 4 weeks Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=311340
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Merge from headSimon J. Gerraty2013-09-054-5/+18
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=255263
| * sync from headSimon J. Gerraty2013-04-121-1/+12
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=249429
| * | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | Sync with HEAD.David E. O'Brien2013-02-081-3/+2
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246555
| * | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | Print file names without stdio buffering to avoid mixing buffered andJaakko Heinonen2013-06-094-5/+18
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | unbuffered ouput. PR: bin/176886 Reviewed by: mjg Notes: svn path=/head/; revision=251565
* | | Remove EOL whitespace accidentally introduced in r248393.Joel Dahl2013-03-171-1/+1
| | | | | | | | | | | | Notes: svn path=/head/; revision=248414
* | | Add a couple of examples.Joel Dahl2013-03-161-1/+12
| |/ |/| | | | | | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=248393
* | Use calloc() to get zeroed memory.Xin LI2013-01-081-3/+2
|/ | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=245184
* Add missing static keywords to tail(1)Ed Schouten2011-11-062-4/+4
| | | | Notes: svn path=/head/; revision=227184
* tail: Fix crash if -F'ed file's filesystem disappears.Jilles Tjoelker2011-08-141-2/+4
| | | | | | | | | | | | | | | | If tail notices that a file it is following no longer exists (because stat() fails), it will output any final lines and then close the file. If the read operation also causes an error, such as when the filesystem is forcefully unmounted, it closes the file as well, leading to fclose(NULL) and a segmentation fault. PR: bin/159750 Submitted by: swills Approved by: re (kib) MFC after: 1 week Notes: svn path=/head/; revision=224865
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-117-28/+0
| | | | | | | | | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change Also add $FreeBSD$ to a few files to keep svn happy. Discussed with: imp, rwatson Notes: svn path=/head/; revision=216370
* Build usr.bin/ with WARNS=6 by default.Ed Schouten2010-01-021-1/+0
| | | | | | | Also add some missing $FreeBSD$ to keep svn happy. Notes: svn path=/head/; revision=201386
* ANSIfy various tools in usr.bin/.Ed Schouten2010-01-021-1/+1
| | | | | | | | Most of these tools properly build at WARNS=6, except for their K&R function declarations. Fix this, so we can bump WARNS as well. Notes: svn path=/head/; revision=201382
* Use our canonical .Dd format.Christian Brueffer2009-11-021-1/+1
| | | | | | | Submitted by: Ulrich Spoerlein Notes: svn path=/head/; revision=198788
* Change the behaviour of -F slightly; it now persists (forever) inBrian Somers2009-06-057-107/+144
| | | | | | | | | | | | | | | | | | | | | trying to open files rather than giving up when it encounters an error. ENOENT errors are not reported. As a result, files that are moved away then recreated are not at risk of being 'lost' to tail. Files that are recreated and temporarily have unreadable permissions will be shown when they are fixed. This behaviour is consistent with the GNU version of tail but without the verbiage that goes with the GNU version. This change also fixes error messages accompanying -f and -F. They no longer report problems with (null)! MFC after: 3 weeks Notes: svn path=/head/; revision=193488
* Nuking the temporary pointer once it is properly tracked in local storage.Tai-hwa Liang2007-11-221-0/+1
| | | | | | | | | | | | | | | | This should fix the double free() bug where there's no tailing newline(\n) character: current# echo -n test | tail testAssertion failed: (run->magic == ARENA_RUN_MAGIC), function arena_dalloc, file /usr/src/lib/libc/stdlib/malloc.c, line 2448. Abort (core dumped) Reviewed by: kib MFC after: 3 days Notes: svn path=/head/; revision=173838
* initialize variables, WARNS=6 compliantPhilippe Charnier2007-11-023-1/+3
| | | | Notes: svn path=/head/; revision=173285
* Fix various memory leaks.Konstantin Belousov2007-10-171-3/+13
| | | | | | | | | Submitted by: rdivacky Obtained from: OpenBSD MFC after: 1 week Notes: svn path=/head/; revision=172719
* Markup revision.Ruslan Ermilov2006-12-241-20/+20
| | | | Notes: svn path=/head/; revision=165527
* Better handle the -F case:Marcel Moolenaar2006-10-211-7/+5
| | | | | | | | | | | | | | | | | | | | o When stat(2) fails (i.e. the file has been moved) there's no new file with the same name yet, so keep showing the file that's open. This yields the same behaviour as -f, for which we don't stat(2). o When a new file with the same name has been created (i.e stat(2) succeeds but the inode or device numbers differ from the opened file), show any new lines in the opened file (i.e. the old or rotated file) before reopening the new file. These changes fix the observed behaviour that tail(1) doesn't show the very last lines of the rotated (log) files. PR: bin/101979 Tested by: Jos Backus <jos@catnook.com> MFC after: 2 months Notes: svn path=/head/; revision=163587
* - Simplify the formatting in the SYNOPSIS.Ruslan Ermilov2006-06-302-4/+3
| | | | | | | - Add the forgotten new option in usage(). Notes: svn path=/head/; revision=160049
* Add a -q option to suppress header lines when multiple files are specified.Florent Thoumie2006-06-294-8/+19
| | | | | | | | Approved by: cperciva (mentor) MFC after: 1 week Notes: svn path=/head/; revision=160045
* Unbreak tail -f on non-local filesystems.Paul Saab2005-08-261-0/+10
| | | | Notes: svn path=/head/; revision=149485
* Back out revision 1.19 and 1.20 until I find mental clarity to deal withEivind Eklund2005-06-011-1/+7
| | | | | | | issues bde pointed out. Notes: svn path=/head/; revision=146882
* Remove an errno reset that became unnecessary.Eivind Eklund2005-05-261-1/+0
| | | | | | | Noticed by: juli Notes: svn path=/head/; revision=146659
* We are past 4.4BSD - use our new-found stat flags for pipes and fifos.Eivind Eklund2005-05-261-6/+1
| | | | Notes: svn path=/head/; revision=146656
* Don't skip the initialisation of tl->len when we hit an EOF immediatelyIan Dowse2005-03-201-3/+2
| | | | | | | | | after allocating a new buffer. This bug caused `tail -r < /dev/null' to core dump when the `J' malloc option is set, and also affected any other input that was an exact multiple of 128k. Notes: svn path=/head/; revision=143891
* Save last displayed file by having the "last" pointer global and save itXin LI2005-02-041-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | during we show the first file's tail. Instead of: tarsier% tail -f 1 2 ==> 1 <== foo bar ==> 2 <== bar foo ==> 2 <== bar2 foo2 Now with this change, we have: tarsier% tail -f 1 2 ==> 1 <== foo bar ==> 2 <== bar foo bar2 foo2 While I'm there, move a comment to where it should belong to. Also, const'ify the "last" static because we will never need to change the contents it points to. MFC After: 1 week Notes: svn path=/head/; revision=141279
* Added the EXIT STATUS section where appropriate.Ruslan Ermilov2005-01-171-1/+1
| | | | Notes: svn path=/head/; revision=140368
* Don't reprint file names unnecessarily.Brian Somers2005-01-121-4/+4
| | | | | | | | | PR: 75028 Submitted by: mteterin at 250-217 dot customer dot cloud9 dot net MFC after: 7 days Notes: svn path=/head/; revision=140101
* Bump WARNS to 4 as this seems OK on the alpha now.David Malone2005-01-101-1/+1
| | | | Notes: svn path=/head/; revision=139995
* Cast size_t to off_t before adding them to avoid warnings on the alpha.David Malone2005-01-102-4/+6
| | | | | | | Use %ld and intmax_t for printing an off_t. Notes: svn path=/head/; revision=139994
* Some variables became unused or global in the last change to thisDavid Malone2005-01-101-9/+5
| | | | | | | | | | file. Remove the now redundant declarations. Add declarations for the new show and set_events functions and make them static. Notes: svn path=/head/; revision=139993
* Add support for following more than one file i.e.Paul Richards2004-11-043-96/+200
| | | | | | | tail -f file1 file2 Notes: svn path=/head/; revision=137225
* Revert a WIP change that shouldn't have been in last commit.Paul Richards2004-11-031-4/+2
| | | | Notes: svn path=/head/; revision=137162
* Convert to ANSI style function definitions.Paul Richards2004-11-035-31/+12
| | | | Notes: svn path=/head/; revision=137157
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-1/+1
| | | | Notes: svn path=/head/; revision=131491
* Removed check of st_rdev changing in the -F support. st_rdev for regularDavid Greenman2003-08-141-1/+0
| | | | | | | | | | | | | | files is usually the first direct block pointer. Since FreeBSD does automatic block reallocation to reduce filesystem fragmentation, the file being tailed can be relocated to different blocks 'on-the-fly', making the check for st_rdev unreliable. The result of this bug is tail -F pseudo-randomnly thinking the file was rotated when it wasn't, and as a result, spews out the entire file trying to catch up. MFC after: 3 days Notes: svn path=/head/; revision=118900
* Revert part of the last commit. This fixes tail for pipes.Mark Murray2003-06-101-8/+7
| | | | | | | Submitted by: joerg Notes: svn path=/head/; revision=116156
* When doing tail -F, return if the freopen() of the file fails instead ofTim J. Robbins2002-12-151-0/+1
| | | | | | | trying to use a null file pointer. Notes: svn path=/head/; revision=107901
* revert WARNS=4, it makes the alpha compile sad.Alfred Perlstein2002-07-151-1/+1
| | | | Notes: svn path=/head/; revision=100063