mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 07:28:11 +00:00
tail: Use pledge()
This commit is contained in:
parent
0c44a12247
commit
70defb34e6
1 changed files with 10 additions and 0 deletions
|
@ -70,6 +70,11 @@ off_t find_seek_pos(CFile& file, int wanted_lines)
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (pledge("stdio rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
CArgsParser args_parser("tail");
|
||||
|
||||
args_parser.add_arg("f", "follow -- appended data is output as it is written to the file");
|
||||
|
@ -101,6 +106,11 @@ int main(int argc, char* argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (pledge("stdio", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool flag_follow = args.is_present("f");
|
||||
auto pos = find_seek_pos(*f, line_count);
|
||||
return tail_from_pos(*f, pos, flag_follow);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue