summaryrefslogtreecommitdiff
path: root/Userland
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
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')
-rw-r--r--Userland/allocate.cpp4
-rw-r--r--Userland/aplay.cpp2
-rw-r--r--Userland/avol.cpp2
-rw-r--r--Userland/cal.cpp8
-rw-r--r--Userland/chroot.cpp6
-rw-r--r--Userland/copy.cpp10
-rw-r--r--Userland/cp.cpp4
-rw-r--r--Userland/df.cpp4
-rw-r--r--Userland/disk_benchmark.cpp4
-rw-r--r--Userland/dmesg.cpp4
-rw-r--r--Userland/gron.cpp4
-rw-r--r--Userland/head.cpp4
-rw-r--r--Userland/html.cpp6
-rw-r--r--Userland/id.cpp2
-rw-r--r--Userland/ifconfig.cpp4
-rw-r--r--Userland/jp.cpp4
-rw-r--r--Userland/keymap.cpp10
-rw-r--r--Userland/killall.cpp2
-rw-r--r--Userland/ln.cpp2
-rw-r--r--Userland/ls.cpp8
-rw-r--r--Userland/lspci.cpp4
-rw-r--r--Userland/man.cpp4
-rw-r--r--Userland/md.cpp6
-rw-r--r--Userland/mount.cpp14
-rw-r--r--Userland/nl.cpp6
-rw-r--r--Userland/pape.cpp6
-rw-r--r--Userland/paste.cpp2
-rw-r--r--Userland/pidof.cpp4
-rw-r--r--Userland/pro.cpp2
-rw-r--r--Userland/ps.cpp2
-rw-r--r--Userland/rm.cpp3
-rw-r--r--Userland/rpcdump.cpp6
-rw-r--r--Userland/shutdown.cpp2
-rw-r--r--Userland/sysctl.cpp12
-rw-r--r--Userland/tail.cpp12
-rw-r--r--Userland/tee.cpp4
-rw-r--r--Userland/top.cpp2
-rw-r--r--Userland/truncate.cpp2
-rw-r--r--Userland/umount.cpp2
-rw-r--r--Userland/useradd.cpp2
-rw-r--r--Userland/wc.cpp4
41 files changed, 97 insertions, 98 deletions
diff --git a/Userland/allocate.cpp b/Userland/allocate.cpp
index f016d6c4d6..a5c6d17cad 100644
--- a/Userland/allocate.cpp
+++ b/Userland/allocate.cpp
@@ -72,7 +72,7 @@ int main(int argc, char** argv)
break;
}
- CElapsedTimer timer;
+ Core::ElapsedTimer timer;
printf("allocating memory (%d bytes)...\n", count);
timer.start();
@@ -86,7 +86,7 @@ int main(int argc, char** argv)
auto pages = count / 4096;
auto step = pages / 10;
- CElapsedTimer timer2;
+ Core::ElapsedTimer timer2;
printf("writing one byte to each page of allocated memory...\n");
timer.start();
diff --git a/Userland/aplay.cpp b/Userland/aplay.cpp
index 1f2cdd1d0a..eb1c1497b2 100644
--- a/Userland/aplay.cpp
+++ b/Userland/aplay.cpp
@@ -32,7 +32,7 @@
int main(int argc, char** argv)
{
- CEventLoop loop;
+ Core::EventLoop loop;
if (argc < 2) {
fprintf(stderr, "Need a WAV to play\n");
return 1;
diff --git a/Userland/avol.cpp b/Userland/avol.cpp
index 6a9b516518..65eb78bf59 100644
--- a/Userland/avol.cpp
+++ b/Userland/avol.cpp
@@ -30,7 +30,7 @@
int main(int argc, char** argv)
{
- CEventLoop loop;
+ Core::EventLoop loop;
auto audio_client = AClientConnection::construct();
audio_client->handshake();
diff --git a/Userland/cal.cpp b/Userland/cal.cpp
index dd454f8c54..8c2a72d080 100644
--- a/Userland/cal.cpp
+++ b/Userland/cal.cpp
@@ -132,11 +132,11 @@ int main(int argc, char** argv)
int month = 0;
int year = 0;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
// FIXME: This should ensure two values get parsed as month + year
- args_parser.add_positional_argument(day, "Day of year", "day", CArgsParser::Required::No);
- args_parser.add_positional_argument(month, "Month", "month", CArgsParser::Required::No);
- args_parser.add_positional_argument(year, "Year", "year", CArgsParser::Required::No);
+ args_parser.add_positional_argument(day, "Day of year", "day", Core::ArgsParser::Required::No);
+ args_parser.add_positional_argument(month, "Month", "month", Core::ArgsParser::Required::No);
+ args_parser.add_positional_argument(year, "Year", "year", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
time_t now = time(nullptr);
diff --git a/Userland/chroot.cpp b/Userland/chroot.cpp
index e4e5cd3b6f..82d5f1f7c1 100644
--- a/Userland/chroot.cpp
+++ b/Userland/chroot.cpp
@@ -35,11 +35,11 @@ int main(int argc, char** argv)
const char* program = "/bin/Shell";
int flags = -1;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_positional_argument(path, "New root directory", "path");
- args_parser.add_positional_argument(program, "Program to run", "program", CArgsParser::Required::No);
+ args_parser.add_positional_argument(program, "Program to run", "program", Core::ArgsParser::Required::No);
- CArgsParser::Option option {
+ Core::ArgsParser::Option option {
true,
"Mount options",
"options",
diff --git a/Userland/copy.cpp b/Userland/copy.cpp
index aa74e815f9..0430bdef49 100644
--- a/Userland/copy.cpp
+++ b/Userland/copy.cpp
@@ -44,9 +44,9 @@ Options parse_options(int argc, char* argv[])
const char* type = nullptr;
Vector<const char*> text;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(type, "Pick a type", "type", 't', "type");
- args_parser.add_positional_argument(text, "Text to copy", "text", CArgsParser::Required::No);
+ args_parser.add_positional_argument(text, "Text to copy", "text", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
Options options;
@@ -54,11 +54,11 @@ Options parse_options(int argc, char* argv[])
if (text.is_empty()) {
// Copy our stdin.
- auto c_stdin = CFile::construct();
+ auto c_stdin = Core::File::construct();
bool success = c_stdin->open(
STDIN_FILENO,
- CIODevice::OpenMode::ReadOnly,
- CFile::ShouldCloseFileDescription::No);
+ Core::IODevice::OpenMode::ReadOnly,
+ Core::File::ShouldCloseFileDescription::No);
ASSERT(success);
auto buffer = c_stdin->read_all();
dbg() << "Read size " << buffer.size();
diff --git a/Userland/cp.cpp b/Userland/cp.cpp
index 2a6adc1f7f..a9694bed4a 100644
--- a/Userland/cp.cpp
+++ b/Userland/cp.cpp
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
Vector<const char*> sources;
const char* destination = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(recursion_allowed, "Copy directories recursively", "recursive", 'r');
args_parser.add_positional_argument(sources, "Source file path", "source");
args_parser.add_positional_argument(destination, "Destination file path", "destination");
@@ -174,7 +174,7 @@ bool copy_directory(String src_path, String dst_path)
perror("cp: mkdir");
return false;
}
- CDirIterator di(src_path, CDirIterator::SkipDots);
+ Core::DirIterator di(src_path, Core::DirIterator::SkipDots);
if (di.has_error()) {
fprintf(stderr, "cp: CDirIterator: %s\n", di.error_string());
return false;
diff --git a/Userland/df.cpp b/Userland/df.cpp
index 4fa4a94bf7..af378e8f60 100644
--- a/Userland/df.cpp
+++ b/Userland/df.cpp
@@ -45,8 +45,8 @@ struct FileSystem {
int main(int, char**)
{
- auto file = CFile::construct("/proc/df");
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct("/proc/df");
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Failed to open /proc/df: %s\n", file->error_string());
return 1;
}
diff --git a/Userland/disk_benchmark.cpp b/Userland/disk_benchmark.cpp
index 7de76943ca..66f2606815 100644
--- a/Userland/disk_benchmark.cpp
+++ b/Userland/disk_benchmark.cpp
@@ -119,7 +119,7 @@ int main(int argc, char** argv)
Vector<Result> results;
printf("Running: file_size=%d block_size=%d\n", file_size, block_size);
- CElapsedTimer timer;
+ Core::ElapsedTimer timer;
timer.start();
while (timer.elapsed() < time_per_benchmark * 1000) {
printf(".");
@@ -160,7 +160,7 @@ Result benchmark(const String& filename, int file_size, int block_size, ByteBuff
Result res;
- CElapsedTimer timer;
+ Core::ElapsedTimer timer;
timer.start();
int nwrote = 0;
diff --git a/Userland/dmesg.cpp b/Userland/dmesg.cpp
index 4e7492bd5e..05134e3f64 100644
--- a/Userland/dmesg.cpp
+++ b/Userland/dmesg.cpp
@@ -46,8 +46,8 @@ int main(int argc, char** argv)
(void)argc;
(void)argv;
- auto f = CFile::construct("/proc/dmesg");
- if (!f->open(CIODevice::ReadOnly)) {
+ auto f = Core::File::construct("/proc/dmesg");
+ if (!f->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "open: failed to open /proc/dmesg: %s\n", f->error_string());
return 1;
}
diff --git a/Userland/gron.cpp b/Userland/gron.cpp
index 1a2d7816bd..ceba6438f9 100644
--- a/Userland/gron.cpp
+++ b/Userland/gron.cpp
@@ -48,8 +48,8 @@ int main(int argc, char** argv)
fprintf(stderr, "usage: gron <file>\n");
return 0;
}
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Couldn't open %s for reading: %s\n", argv[1], file->error_string());
return 1;
}
diff --git a/Userland/head.cpp b/Userland/head.cpp
index aaeac55fa5..d4c4613cd9 100644
--- a/Userland/head.cpp
+++ b/Userland/head.cpp
@@ -41,12 +41,12 @@ int main(int argc, char** argv)
bool always_print_filenames = false;
Vector<const char*> files;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(line_count, "Number of lines to print (default 10)", "lines", 'n', "number");
args_parser.add_option(char_count, "Number of characters to print", "characters", 'c', "number");
args_parser.add_option(never_print_filenames, "Never print file names", "quiet", 'q');
args_parser.add_option(always_print_filenames, "Always print file names", "verbose", 'v');
- args_parser.add_positional_argument(files, "File to process", "file", CArgsParser::Required::No);
+ args_parser.add_positional_argument(files, "File to process", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
if (line_count == 0 && char_count == 0) {
diff --git a/Userland/html.cpp b/Userland/html.cpp
index 58e5ab88dd..b32fb2495e 100644
--- a/Userland/html.cpp
+++ b/Userland/html.cpp
@@ -46,13 +46,13 @@ int main(int argc, char** argv)
{
GApplication app(argc, argv);
- auto f = CFile::construct();
+ auto f = Core::File::construct();
bool success;
if (argc < 2) {
- success = f->open(STDIN_FILENO, CIODevice::OpenMode::ReadOnly, CFile::ShouldCloseFileDescription::No);
+ success = f->open(STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescription::No);
} else {
f->set_filename(argv[1]);
- success = f->open(CIODevice::OpenMode::ReadOnly);
+ success = f->open(Core::IODevice::OpenMode::ReadOnly);
}
if (!success) {
fprintf(stderr, "Error: %s\n", f->error_string());
diff --git a/Userland/id.cpp b/Userland/id.cpp
index 90276e15f0..dd21bf3ae1 100644
--- a/Userland/id.cpp
+++ b/Userland/id.cpp
@@ -60,7 +60,7 @@ int main(int argc, char** argv)
return 1;
}
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(flag_print_uid, "Print UID", nullptr, 'u');
args_parser.add_option(flag_print_gid, "Print GID", nullptr, 'g');
args_parser.add_option(flag_print_gid_all, "Print all GIDs", nullptr, 'G');
diff --git a/Userland/ifconfig.cpp b/Userland/ifconfig.cpp
index dfebd5aec5..7a2d347551 100644
--- a/Userland/ifconfig.cpp
+++ b/Userland/ifconfig.cpp
@@ -78,8 +78,8 @@ int main(int argc, char** argv)
return 0;
}
- auto file = CFile::construct("/proc/net/adapters");
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct("/proc/net/adapters");
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error: %s\n", file->error_string());
return 1;
}
diff --git a/Userland/jp.cpp b/Userland/jp.cpp
index df4a62e260..0bd2246fba 100644
--- a/Userland/jp.cpp
+++ b/Userland/jp.cpp
@@ -44,8 +44,8 @@ int main(int argc, char** argv)
fprintf(stderr, "usage: jp <file>\n");
return 0;
}
- auto file = CFile::construct(argv[1]);
- if (!file->open(CIODevice::ReadOnly)) {
+ auto file = Core::File::construct(argv[1]);
+ if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Couldn't open %s for reading: %s\n", argv[1], file->error_string());
return 1;
}
diff --git a/Userland/keymap.cpp b/Userland/keymap.cpp
index 310b8d650a..8708e8ae14 100644
--- a/Userland/keymap.cpp
+++ b/Userland/keymap.cpp
@@ -69,10 +69,10 @@ char* read_map(const JsonObject& json, const String& name)
return map;
}
-RefPtr<CFile> open_keymap_file(String& filename)
+RefPtr<Core::File> open_keymap_file(String& filename)
{
- auto file = CFile::construct(filename);
- if (file->open(CIODevice::ReadOnly))
+ auto file = Core::File::construct(filename);
+ if (file->open(Core::IODevice::ReadOnly))
return file;
if (!filename.ends_with(".json")) {
@@ -81,8 +81,8 @@ RefPtr<CFile> open_keymap_file(String& filename)
full_path.append(filename);
full_path.append(".json");
filename = full_path.to_string();
- file = CFile::construct(filename);
- if (file->open(CIODevice::ReadOnly))
+ file = Core::File::construct(filename);
+ if (file->open(Core::IODevice::ReadOnly))
return file;
}
diff --git a/Userland/killall.cpp b/Userland/killall.cpp
index b8923a7130..bc680ff7bd 100644
--- a/Userland/killall.cpp
+++ b/Userland/killall.cpp
@@ -39,7 +39,7 @@ static void print_usage_and_exit()
static int kill_all(const String& process_name, const unsigned signum)
{
- auto processes = CProcessStatisticsReader().get_all();
+ auto processes = Core::ProcessStatisticsReader().get_all();
for (auto& it : processes) {
if (it.value.name == process_name) {
diff --git a/Userland/ln.cpp b/Userland/ln.cpp
index c567db7dc9..a7c2b1bb51 100644
--- a/Userland/ln.cpp
+++ b/Userland/ln.cpp
@@ -36,7 +36,7 @@ int main(int argc, char** argv)
const char* target = nullptr;
const char* path = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(symbolic, "Create a symlink", "symbolic", 's');
args_parser.add_positional_argument(target, "Link target", "target");
args_parser.add_positional_argument(path, "Link path", "path");
diff --git a/Userland/ls.cpp b/Userland/ls.cpp
index 072cb16147..a2f68c33fb 100644
--- a/Userland/ls.cpp
+++ b/Userland/ls.cpp
@@ -85,7 +85,7 @@ int main(int argc, char** argv)
Vector<const char*> paths;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(flag_show_dotfiles, "Show dotfiles", "all", 'a');
args_parser.add_option(flag_long, "Display long info", "long", 'l');
args_parser.add_option(flag_sort_by_timestamp, "Sort files by timestamp", nullptr, 't');
@@ -94,7 +94,7 @@ int main(int argc, char** argv)
args_parser.add_option(flag_show_inode, "Show inode ids", "inode", 'i');
args_parser.add_option(flag_print_numeric, "In long format, display numeric UID/GID", "numeric-uid-gid", 'n');
args_parser.add_option(flag_human_readable, "Print human-readable sizes", "human-readable", 'h');
- args_parser.add_positional_argument(paths, "Directory to list", "path", CArgsParser::Required::No);
+ args_parser.add_positional_argument(paths, "Directory to list", "path", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
if (flag_long) {
@@ -288,7 +288,7 @@ bool print_filesystem_object(const String& path, const String& name, const struc
int do_file_system_object_long(const char* path)
{
- CDirIterator di(path, !flag_show_dotfiles ? CDirIterator::SkipDots : CDirIterator::Flags::NoFlags);
+ Core::DirIterator di(path, !flag_show_dotfiles ? Core::DirIterator::SkipDots : Core::DirIterator::Flags::NoFlags);
if (di.has_error()) {
if (di.error() == ENOTDIR) {
struct stat stat;
@@ -366,7 +366,7 @@ bool print_filesystem_object_short(const char* path, const char* name, int* npri
int do_file_system_object_short(const char* path)
{
- CDirIterator di(path, !flag_show_dotfiles ? CDirIterator::SkipDots : CDirIterator::Flags::NoFlags);
+ Core::DirIterator di(path, !flag_show_dotfiles ? Core::DirIterator::SkipDots : Core::DirIterator::Flags::NoFlags);
if (di.has_error()) {
if (di.error() == ENOTDIR) {
int nprinted;
diff --git a/Userland/lspci.cpp b/Userland/lspci.cpp
index 8800a887e5..ff2907928e 100644
--- a/Userland/lspci.cpp
+++ b/Userland/lspci.cpp
@@ -57,8 +57,8 @@ int main(int argc, char** argv)
if (!db)
fprintf(stderr, "Couldn't open PCI ID database\n");
- auto proc_pci = CFile::construct("/proc/pci");
- if (!proc_pci->open(CIODevice::ReadOnly)) {
+ auto proc_pci = Core::File::construct("/proc/pci");
+ if (!proc_pci->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error: %s\n", proc_pci->error_string());
return 1;
}
diff --git a/Userland/man.cpp b/Userland/man.cpp
index 91066fec0b..44ccdaebfe 100644
--- a/Userland/man.cpp
+++ b/Userland/man.cpp
@@ -86,10 +86,10 @@ int main(int argc, char* argv[])
}
}
- auto file = CFile::construct();
+ auto file = Core::File::construct();
file->set_filename(make_path(section));
- if (!file->open(CIODevice::OpenMode::ReadOnly)) {
+ if (!file->open(Core::IODevice::OpenMode::ReadOnly)) {
perror("Failed to open man page file");
exit(1);
}
diff --git a/Userland/md.cpp b/Userland/md.cpp
index fc3fc51bd3..dda60557d7 100644
--- a/Userland/md.cpp
+++ b/Userland/md.cpp
@@ -45,13 +45,13 @@ int main(int argc, char* argv[])
else
file_name = argv[i];
- auto file = CFile::construct();;
+ auto file = Core::File::construct();;
bool success;
if (file_name == nullptr) {
- success = file->open(STDIN_FILENO, CIODevice::OpenMode::ReadOnly, CFile::ShouldCloseFileDescription::No);
+ success = file->open(STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescription::No);
} else {
file->set_filename(file_name);
- success = file->open(CIODevice::OpenMode::ReadOnly);
+ success = file->open(Core::IODevice::OpenMode::ReadOnly);
}
if (!success) {
fprintf(stderr, "Error: %s\n", file->error_string());
diff --git a/Userland/mount.cpp b/Userland/mount.cpp
index 4260946d87..fb90ed4ff2 100644
--- a/Userland/mount.cpp
+++ b/Userland/mount.cpp
@@ -58,8 +58,8 @@ bool mount_all()
// Mount all filesystems listed in /etc/fstab.
dbg() << "Mounting all filesystems...";
- auto fstab = CFile::construct("/etc/fstab");
- if (!fstab->open(CIODevice::OpenMode::ReadOnly)) {
+ auto fstab = Core::File::construct("/etc/fstab");
+ if (!fstab->open(Core::IODevice::OpenMode::ReadOnly)) {
fprintf(stderr, "Failed to open /etc/fstab: %s\n", fstab->error_string());
return false;
}
@@ -111,8 +111,8 @@ bool mount_all()
bool print_mounts()
{
// Output info about currently mounted filesystems.
- auto df = CFile::construct("/proc/df");
- if (!df->open(CIODevice::ReadOnly)) {
+ auto df = Core::File::construct("/proc/df");
+ if (!df->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Failed to open /proc/df: %s\n", df->error_string());
return false;
}
@@ -158,9 +158,9 @@ int main(int argc, char** argv)
const char* options = nullptr;
bool should_mount_all = false;
- CArgsParser args_parser;
- args_parser.add_positional_argument(source, "Source path", "source", CArgsParser::Required::No);
- args_parser.add_positional_argument(mountpoint, "Mount point", "mountpoint", CArgsParser::Required::No);
+ Core::ArgsParser args_parser;
+ args_parser.add_positional_argument(source, "Source path", "source", Core::ArgsParser::Required::No);
+ args_parser.add_positional_argument(mountpoint, "Mount point", "mountpoint", Core::ArgsParser::Required::No);
args_parser.add_option(fs_type, "File system type", nullptr, 't', "fstype");
args_parser.add_option(options, "Mount options", nullptr, 'o', "options");
args_parser.add_option(should_mount_all, "Mount all file systems listed in /etc/fstab", nullptr, 'a');
diff --git a/Userland/nl.cpp b/Userland/nl.cpp
index ab7ca2615a..99aed8a362 100644
--- a/Userland/nl.cpp
+++ b/Userland/nl.cpp
@@ -46,9 +46,9 @@ int main(int argc, char** argv)
int number_width = 6;
Vector<const char*> files;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
- CArgsParser::Option number_style_option {
+ Core::ArgsParser::Option number_style_option {
true,
"Line numbering style: 't' for non-empty lines, 'a' for all lines, 'n' for no lines",
"body-numbering",
@@ -73,7 +73,7 @@ int main(int argc, char** argv)
args_parser.add_option(separator, "Separator between line numbers and lines", "separator", 's', "string");
args_parser.add_option(start_number, "Initial line number", "startnum", 'v', "number");
args_parser.add_option(number_width, "Number width", "width", 'w', "number");
- args_parser.add_positional_argument(files, "Files to process", "file", CArgsParser::Required::No);
+ args_parser.add_positional_argument(files, "Files to process", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
Vector<FILE*> file_pointers;
diff --git a/Userland/pape.cpp b/Userland/pape.cpp
index 317f54c133..8b35234bc1 100644
--- a/Userland/pape.cpp
+++ b/Userland/pape.cpp
@@ -42,7 +42,7 @@
static int handle_show_all()
{
- CDirIterator di("/res/wallpapers", CDirIterator::SkipDots);
+ Core::DirIterator di("/res/wallpapers", Core::DirIterator::SkipDots);
if (di.has_error()) {
fprintf(stderr, "CDirIterator: %s\n", di.error_string());
return 1;
@@ -80,10 +80,10 @@ int main(int argc, char** argv)
bool show_current = false;
const char* name = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(show_all, "Show all wallpapers", "show-all", 'a');
args_parser.add_option(show_current, "Show current wallpaper", "show-current", 'c');
- args_parser.add_positional_argument(name, "Wallpaper to set", "name", CArgsParser::Required::No);
+ args_parser.add_positional_argument(name, "Wallpaper to set", "name", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
GApplication app(argc, argv);
diff --git a/Userland/paste.cpp b/Userland/paste.cpp
index f14ad4588b..0f82a31bce 100644
--- a/Userland/paste.cpp
+++ b/Userland/paste.cpp
@@ -36,7 +36,7 @@ int main(int argc, char* argv[])
bool print_type = false;
bool no_newline = false;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(print_type, "Display the copied type", "print-type", 0);
args_parser.add_option(no_newline, "Do not append a newline", "no-newline", 'n');
args_parser.parse(argc, argv);
diff --git a/Userland/pidof.cpp b/Userland/pidof.cpp
index 332cc794f0..049da70e8e 100644
--- a/Userland/pidof.cpp
+++ b/Userland/pidof.cpp
@@ -38,7 +38,7 @@ static int pid_of(const String& process_name, bool single_shot, bool omit_pid, p
{
bool displayed_at_least_one = false;
- auto processes = CProcessStatisticsReader().get_all();
+ auto processes = Core::ProcessStatisticsReader().get_all();
for (auto& it : processes) {
if (it.value.name == process_name) {
@@ -64,7 +64,7 @@ int main(int argc, char** argv)
const char* omit_pid_value = nullptr;
const char* process_name = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(single_shot, "Only return one pid", nullptr, 's');
args_parser.add_option(omit_pid_value, "Omit the given PID, or the parent process if the special value %PPID is passed", nullptr, 'o', "pid");
args_parser.add_positional_argument(process_name, "Process name to search for", "process-name");
diff --git a/Userland/pro.cpp b/Userland/pro.cpp
index f647371cc6..09e58d5de3 100644
--- a/Userland/pro.cpp
+++ b/Userland/pro.cpp
@@ -45,7 +45,7 @@ int main(int argc, char** argv)
return 1;
}
- CEventLoop loop;
+ Core::EventLoop loop;
auto protocol_client = LibProtocol::Client::construct();
auto download = protocol_client->start_download(url.to_string());
diff --git a/Userland/ps.cpp b/Userland/ps.cpp
index 595faf8bc0..dc71708aa9 100644
--- a/Userland/ps.cpp
+++ b/Userland/ps.cpp
@@ -37,7 +37,7 @@ int main(int argc, char** argv)
printf("PID TPG PGP SID UID STATE PPID NSCHED FDS TTY NAME\n");
- auto all_processes = CProcessStatisticsReader::get_all();
+ auto all_processes = Core::ProcessStatisticsReader::get_all();
for (const auto& it : all_processes) {
const auto& proc = it.value;
diff --git a/Userland/rm.cpp b/Userland/rm.cpp
index 3e208ae486..6fbbeb8a2c 100644
--- a/Userland/rm.cpp
+++ b/Userland/rm.cpp
@@ -28,7 +28,6 @@
#include <AK/StringBuilder.h>
#include <AK/Vector.h>
#include <LibCore/CArgsParser.h>
-#include <LibCore/CDirIterator.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
@@ -80,7 +79,7 @@ int main(int argc, char** argv)
bool recursive = false;
const char* path = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(recursive, "Delete directories recursively", "recursive", 'r');
args_parser.add_positional_argument(path, "File to remove", "path");
args_parser.parse(argc, argv);
diff --git a/Userland/rpcdump.cpp b/Userland/rpcdump.cpp
index 271c14e255..f4dc84e109 100644
--- a/Userland/rpcdump.cpp
+++ b/Userland/rpcdump.cpp
@@ -50,11 +50,11 @@ int main(int argc, char** argv)
return 0;
}
- CEventLoop loop;
+ Core::EventLoop loop;
int pid = atoi(argv[1]);
- auto socket = CLocalSocket::construct();
+ auto socket = Core::LocalSocket::construct();
if (pledge("stdio unix", nullptr) < 0) {
perror("pledge");
@@ -88,7 +88,7 @@ int main(int argc, char** argv)
loop.quit(0);
};
- auto success = socket->connect(CSocketAddress::local(String::format("/tmp/rpc.%d", pid)));
+ auto success = socket->connect(Core::SocketAddress::local(String::format("/tmp/rpc.%d", pid)));
if (!success) {
fprintf(stderr, "Couldn't connect to PID %d\n", pid);
return 1;
diff --git a/Userland/shutdown.cpp b/Userland/shutdown.cpp
index 7dd7fecc57..1d44c02144 100644
--- a/Userland/shutdown.cpp
+++ b/Userland/shutdown.cpp
@@ -32,7 +32,7 @@ int main(int argc, char** argv)
{
bool now = false;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(now, "Shut down now", "now", 'n');
args_parser.parse(argc, argv);
diff --git a/Userland/sysctl.cpp b/Userland/sysctl.cpp
index 35497c8cd2..f1525f8b12 100644
--- a/Userland/sysctl.cpp
+++ b/Userland/sysctl.cpp
@@ -43,8 +43,8 @@ static String read_var(const String& name)
builder.append("/proc/sys/");
builder.append(name);
auto path = builder.to_string();
- auto f = CFile::construct(path);
- if (!f->open(CIODevice::ReadOnly)) {
+ auto f = Core::File::construct(path);
+ if (!f->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "open: %s", f->error_string());
exit(1);
}
@@ -62,8 +62,8 @@ static void write_var(const String& name, const String& value)
builder.append("/proc/sys/");
builder.append(name);
auto path = builder.to_string();
- auto f = CFile::construct(path);
- if (!f->open(CIODevice::WriteOnly)) {
+ auto f = Core::File::construct(path);
+ if (!f->open(Core::IODevice::WriteOnly)) {
fprintf(stderr, "open: %s", f->error_string());
exit(1);
}
@@ -76,7 +76,7 @@ static void write_var(const String& name, const String& value)
static int handle_show_all()
{
- CDirIterator di("/proc/sys", CDirIterator::SkipDots);
+ Core::DirIterator di("/proc/sys", Core::DirIterator::SkipDots);
if (di.has_error()) {
fprintf(stderr, "CDirIterator: %s\n", di.error_string());
return 1;
@@ -112,7 +112,7 @@ int main(int argc, char** argv)
bool show_all = false;
const char* var = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(show_all, "Show all variables", nullptr, 'a');
args_parser.add_positional_argument(var, "Command (var[=value])", "command");
args_parser.parse(argc, argv);
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);
}
diff --git a/Userland/tee.cpp b/Userland/tee.cpp
index 40005366a9..ec9809d2c5 100644
--- a/Userland/tee.cpp
+++ b/Userland/tee.cpp
@@ -123,10 +123,10 @@ int main(int argc, char** argv)
bool ignore_interrupts = false;
Vector<const char*> paths;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(append, "Append, don't overwrite", "append", 'a');
args_parser.add_option(ignore_interrupts, "Ignore SIGINT", "ignore-interrupts", 'i');
- args_parser.add_positional_argument(paths, "Files to copy stdin to", "file", CArgsParser::Required::No);
+ args_parser.add_positional_argument(paths, "Files to copy stdin to", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
if (ignore_interrupts) {
diff --git a/Userland/top.cpp b/Userland/top.cpp
index 723024234b..cca0a7c24d 100644
--- a/Userland/top.cpp
+++ b/Userland/top.cpp
@@ -93,7 +93,7 @@ static Snapshot get_snapshot()
{
Snapshot snapshot;
- auto all_processes = CProcessStatisticsReader::get_all();
+ auto all_processes = Core::ProcessStatisticsReader::get_all();
for (auto& it : all_processes) {
auto& stats = it.value;
diff --git a/Userland/truncate.cpp b/Userland/truncate.cpp
index 44f5079c17..b6f6d0398d 100644
--- a/Userland/truncate.cpp
+++ b/Userland/truncate.cpp
@@ -42,7 +42,7 @@ int main(int argc, char** argv)
const char* reference = nullptr;
const char* file = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(resize, "Resize the target file to (or by) this size. Prefix with + or - to expand or shrink the file, or a bare number to set the size exactly", "size", 's', "size");
args_parser.add_option(reference, "Resize the target file to match the size of this one", "reference", 'r', "file");
args_parser.add_positional_argument(file, "File path", "file");
diff --git a/Userland/umount.cpp b/Userland/umount.cpp
index 845c3a50bf..d3e708e740 100644
--- a/Userland/umount.cpp
+++ b/Userland/umount.cpp
@@ -32,7 +32,7 @@ int main(int argc, char** argv)
{
const char* mount_point = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_positional_argument(mount_point, "Mount point", "mountpoint");
args_parser.parse(argc, argv);
diff --git a/Userland/useradd.cpp b/Userland/useradd.cpp
index ef5e51b427..6e9a4b8493 100644
--- a/Userland/useradd.cpp
+++ b/Userland/useradd.cpp
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
const char* gecos = "";
const char* username = nullptr;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(home_path, "Home directory for the new user", "home-dir", 'd', "path");
args_parser.add_option(uid, "User ID (uid) for the new user", "uid", 'u', "uid");
args_parser.add_option(gid, "Group ID (gid) for the new user", "gid", 'g', "gid");
diff --git a/Userland/wc.cpp b/Userland/wc.cpp
index 5cb2e95185..b2bb024eb5 100644
--- a/Userland/wc.cpp
+++ b/Userland/wc.cpp
@@ -124,11 +124,11 @@ int main(int argc, char** argv)
{
Vector<const char*> files;
- CArgsParser args_parser;
+ Core::ArgsParser args_parser;
args_parser.add_option(output_line, "Output line count", "lines", 'l');
args_parser.add_option(output_byte, "Output byte count", "bytes", 'c');
args_parser.add_option(output_word, "Output word count", "words", 'w');
- args_parser.add_positional_argument(files, "File to process", "file", CArgsParser::Required::No);
+ args_parser.add_positional_argument(files, "File to process", "file", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
if (!output_line && !output_byte && !output_word)