aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tail
Commit message (Collapse)AuthorAgeFilesLines
* 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
* WARNS=4, addAlfred Perlstein2002-07-142-6/+5
| | | | Notes: svn path=/head/; revision=99983
* Note that this appeared at least as early as PWB UNIX.Juli Mallett2002-06-101-2/+1
| | | | | | | Use the literal string 'PWB UNIX', as we still have no .At macro for it. Notes: svn path=/head/; revision=98107
* Fix up vendor IDs.David Malone2002-04-131-7/+10
| | | | | | | Put a sequence point between writing to a variable and using it. Notes: svn path=/head/; revision=94609
* GCC 3.1 cleanup - add a break after default: at the end of a switchMurray Stokely2002-04-082-0/+2
| | | | | | | statement. Notes: svn path=/head/; revision=94178
* remove __PWarner Losh2002-03-224-13/+13
| | | | Notes: svn path=/head/; revision=92922
* WARNS=2 fixes, use __FBSDID().Mark Murray2001-12-126-67/+78
| | | | Notes: svn path=/head/; revision=87712
* Since kqueue support was added to tail, the "-F" option (check forIan Dowse2001-11-251-30/+34
| | | | | | | | | | | | | | | | | renames/rotations) only detected cases where the file itself was moved or deleted. If part of the path to the file (or a symlink in the path) was changed instead, tail would not notice. Fix this by ensuring that we stat the path at least once every second in the -F case to check for changes. We still use kqueue when possible to inform us quickly when the file has changed. PR: bin/24955 Submitted by: Maxim Konovalov <maxim@macomnet.ru> MFC after: 1 week Notes: svn path=/head/; revision=86888
* Allow "obsolete" (but commonly-used) command line style to be usedBill Fenner2001-10-021-2/+3
| | | | | | | | | with -F, e.g. tail -1 -F /var/log/messages. Submitted by: Maxim Konovalov <maxim@macomnet.ru> Notes: svn path=/head/; revision=84350
* File positions are off_t nowdays, not long, so:Andrey A. Chernov2001-09-014-14/+14
| | | | | | | | | | | | | | long -> off_t strtol -> strtoll fseek -> fseeko NOTE: that fseek not works for >long offsets files per POSIX: [EOVERFLOW] For fseek( ), the resulting file offset would be a value which cannot be represented correctly in an object of type long. Notes: svn path=/head/; revision=82762
* mdoc(7) police: utilize the new .Ex macro.Ruslan Ermilov2001-08-151-3/+1
| | | | Notes: svn path=/head/; revision=81687
* mdoc(7) police: removed HISTORY info from the .Os call.Ruslan Ermilov2001-07-101-1/+1
| | | | Notes: svn path=/head/; revision=79535
* o If the file being tailed is moved back to the original location,Jonathan Lemon2001-06-061-1/+3
| | | | | | | | resume using kqueue to monitor it, if possible. o auto-clear the read filter on EOF; this is needed when tailing a FIFO. Notes: svn path=/head/; revision=77823
* Back out my fseeko -> fseek(END) change - we need to position on what weAndrey A. Chernov2001-03-281-1/+1
| | | | | | | displayed last, not to the end of file Notes: svn path=/head/; revision=74933
* Restore part of my fix spammed in v1.23:Andrey A. Chernov2001-03-271-1/+1
| | | | | | | | | fseeko(file_size, SEEK_SET) -> fseek(0L, SEEK_END) 1) File may grows between operations, so fseeko to file_size may miss 2) 0L, SEEK_END is the same code using in tail in all other places Notes: svn path=/head/; revision=74885
* Fix tail to work on files bigger than 2GB.David Malone2001-03-274-65/+146
| | | | | | | | PR: 14786 Reviewed by: iedowse Notes: svn path=/head/; revision=74876
* Add comment explaining why size not passed directly to mmap, i.e. not relayAndrey A. Chernov2001-03-271-3/+9
| | | | | | | | | on its check. KNF multi-line comments (inspired by bde) Notes: svn path=/head/; revision=74863
* Use SSIZE_MAX instead of INT_MAX, as kernel does ssize_t checkAndrey A. Chernov2001-03-271-1/+3
| | | | | | | Better explanation comment of FIXME section Notes: svn path=/head/; revision=74834
* Treat mmap() error as fatal too, i.e. do exit(1) instead of returnAndrey A. Chernov2001-03-261-1/+1
| | | | Notes: svn path=/head/; revision=74830
* rlines() checks:Andrey A. Chernov2001-03-261-3/+10
| | | | | | | | | | | | | | 1) really check for size overflow by checking negative value. 2) since mmap() not support files over INT_MAX size, add check for it until either mmap() will be fixed or tail will be rewritted to handle large files alternatively. 3) replace fseek(... file_size, SEEK_SET) with fseek(... 0L, SEEK_END) to avoid off_t -> long cast 4) Use exit() if file is too big instead of warning and wrong logic afterwards. Notes: svn path=/head/; revision=74827
* Use EV_SET() macro to initialize kevent structure.Jonathan Lemon2001-02-281-7/+5
| | | | Notes: svn path=/head/; revision=73231