mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:07:45 +00:00
tail: Default tail behavior with no arguments (#209)
Make tail assume you wanted 10 lines of output if no -n option was provided.
This commit is contained in:
parent
908d9458c7
commit
9687f1801b
1 changed files with 4 additions and 0 deletions
|
@ -7,6 +7,8 @@
|
||||||
#include <LibCore/CFile.h>
|
#include <LibCore/CFile.h>
|
||||||
#include <LibCore/CArgsParser.h>
|
#include <LibCore/CArgsParser.h>
|
||||||
|
|
||||||
|
#define DEFAULT_LINE_COUNT 10
|
||||||
|
|
||||||
int tail_from_pos(CFile& file, off_t startline, bool want_follow)
|
int tail_from_pos(CFile& file, off_t startline, bool want_follow)
|
||||||
{
|
{
|
||||||
if (!file.seek(startline + 1))
|
if (!file.seek(startline + 1))
|
||||||
|
@ -95,6 +97,8 @@ int main(int argc, char *argv[])
|
||||||
args_parser.print_usage();
|
args_parser.print_usage();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
line_count = DEFAULT_LINE_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFile f(values[0]);
|
CFile f(values[0]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue