1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:27:35 +00:00

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.
This commit is contained in:
Andreas Kling 2020-02-02 12:34:39 +01:00
parent b7e3810b5c
commit 2d39da5405
265 changed files with 1380 additions and 1167 deletions

View file

@ -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();

View file

@ -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;

View file

@ -30,7 +30,7 @@
int main(int argc, char** argv)
{
CEventLoop loop;
Core::EventLoop loop;
auto audio_client = AClientConnection::construct();
audio_client->handshake();

View file

@ -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);

View file

@ -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",

View file

@ -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();

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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) {

View file

@ -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());

View file

@ -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');

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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) {

View file

@ -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");

View file

@ -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;

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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());

View file

@ -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');

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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");

View file

@ -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());

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);
}

View file

@ -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) {

View file

@ -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;

View file

@ -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");

View file

@ -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);

View file

@ -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");

View file

@ -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)