summaryrefslogtreecommitdiff
path: root/Userland/tail.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-02 12:34:39 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-02 15:15:30 +0100
commit2d39da5405a4527e91e853ddb1e56a539c96c6c1 (patch)
tree342f5d553c844f05b550510de27d5b7c937daf90 /Userland/tail.cpp
parentb7e3810b5c3d7e52217e70eed61132d9f670648d (diff)
downloadserenity-2d39da5405a4527e91e853ddb1e56a539c96c6c1.zip
LibCore: Put all classes in the Core namespace and remove the leading C
I've been wanting to do this for a long time. It's time we start being consistent about how this stuff works. The new convention is: - "LibFoo" is a userspace library that provides the "Foo" namespace. That's it :^) This was pretty tedious to convert and I didn't even start on LibGUI yet. But it's coming up next.
Diffstat (limited to 'Userland/tail.cpp')
-rw-r--r--Userland/tail.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/tail.cpp b/Userland/tail.cpp
index 220d9ab2ef..25c9a1e409 100644
--- a/Userland/tail.cpp
+++ b/Userland/tail.cpp
@@ -35,7 +35,7 @@
#define DEFAULT_LINE_COUNT 10
-int tail_from_pos(CFile& file, off_t startline, bool want_follow)
+int tail_from_pos(Core::File& file, off_t startline, bool want_follow)
{
if (!file.seek(startline + 1))
return 1;
@@ -61,12 +61,12 @@ int tail_from_pos(CFile& file, off_t startline, bool want_follow)
return 0;
}
-off_t find_seek_pos(CFile& file, int wanted_lines)
+off_t find_seek_pos(Core::File& file, int wanted_lines)
{
// Rather than reading the whole file, start at the end and work backwards,
// stopping when we've found the number of lines we want.
off_t pos = 0;
- if (!file.seek(0, CIODevice::SeekMode::FromEndPosition, &pos)) {
+ if (!file.seek(0, Core::IODevice::SeekMode::FromEndPosition, &pos)) {
fprintf(stderr, "Failed to find end of file: %s\n", file.error_string());
return 1;
}
@@ -105,14 +105,14 @@ int main(int argc, char* argv[])
int line_count = DEFAULT_LINE_COUNT;
const char* file = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(follow, "Output data as it is written to the file", "follow", 'f');
args_parser.add_option(line_count, "Fetch the specified number of lines", "lines", 'n', "number");
args_parser.add_positional_argument(file, "File path", "file");
args_parser.parse(argc, argv);
- auto f = CFile::construct(file);
- if (!f->open(CIODevice::ReadOnly)) {
+ auto f = Core::File::construct(file);
+ if (!f->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error opening file %s: %s\n", file, strerror(errno));
exit(1);
}