mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:07:34 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath sendfd unix"));
|
||||
|
||||
const char* path = nullptr;
|
||||
char const* path = nullptr;
|
||||
bool should_loop = false;
|
||||
bool show_sample_progress = false;
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
static bool flag_set;
|
||||
static bool flag_delete;
|
||||
const char* value_ipv4_address = nullptr;
|
||||
const char* value_hw_address = nullptr;
|
||||
char const* value_ipv4_address = nullptr;
|
||||
char const* value_hw_address = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Display or modify the system ARP cache");
|
||||
|
|
|
@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
bool decode = false;
|
||||
const char* filepath = nullptr;
|
||||
char const* filepath = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(decode, "Decode data", "decode", 'd');
|
||||
|
|
|
@ -27,7 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
const char* device = nullptr;
|
||||
char const* device = nullptr;
|
||||
|
||||
bool flag_get_disk_size = false;
|
||||
bool flag_get_block_size = false;
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
const int line_width = 70;
|
||||
const int line_count = 8;
|
||||
const int column_width = 22;
|
||||
int const line_width = 70;
|
||||
int const line_count = 8;
|
||||
int const column_width = 22;
|
||||
|
||||
char print_buffer[line_width * line_count];
|
||||
char temp_buffer[line_width * 8];
|
||||
|
|
|
@ -15,8 +15,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath chown", nullptr));
|
||||
|
||||
const char* gid_arg = nullptr;
|
||||
const char* path = nullptr;
|
||||
char const* gid_arg = nullptr;
|
||||
char const* path = nullptr;
|
||||
bool dont_follow_symlinks = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Vector<const char*> paths;
|
||||
const char* opt_algorithm = nullptr;
|
||||
Vector<char const*> paths;
|
||||
char const* opt_algorithm = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(opt_algorithm, "Checksum algorithm (default 'crc32', use 'list' to list available algorithms)", "algorithm", '\0', nullptr);
|
||||
|
|
|
@ -58,7 +58,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto process_file = [](const String& path, auto& file, int file_number) {
|
||||
auto process_file = [](String const& path, auto& file, int file_number) {
|
||||
if (path == "-") {
|
||||
file = Core::File::standard_input();
|
||||
} else {
|
||||
|
@ -90,14 +90,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (!suppress_col3)
|
||||
col3_fmt = String::formatted("{}{}", String::repeated(tab, tab_count++), print_color ? COL3_COLOR : "{}");
|
||||
|
||||
auto cmp = [&](const String& str1, const String& str2) {
|
||||
auto cmp = [&](String const& str1, String const& str2) {
|
||||
if (case_insensitive)
|
||||
return strcasecmp(str1.characters(), str2.characters());
|
||||
else
|
||||
return strcmp(str1.characters(), str2.characters());
|
||||
};
|
||||
|
||||
auto process_remaining = [](const String& fmt, auto& file, int& count, bool print) {
|
||||
auto process_remaining = [](String const& fmt, auto& file, int& count, bool print) {
|
||||
while (file->can_read_line()) {
|
||||
++count;
|
||||
auto line = file->read_line();
|
||||
|
|
|
@ -24,8 +24,8 @@ struct Options {
|
|||
|
||||
static Options parse_options(Main::Arguments arguments)
|
||||
{
|
||||
const char* type = "text/plain";
|
||||
Vector<const char*> text;
|
||||
char const* type = "text/plain";
|
||||
Vector<char const*> text;
|
||||
bool clear = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Core::ArgsParser args_parser;
|
||||
const char* path = nullptr;
|
||||
char const* path = nullptr;
|
||||
args_parser.add_positional_argument(path, "Cpp File", "cpp-file", Core::ArgsParser::Required::Yes);
|
||||
args_parser.parse(arguments);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Core::ArgsParser args_parser;
|
||||
const char* path = nullptr;
|
||||
char const* path = nullptr;
|
||||
bool tokens_mode = false;
|
||||
args_parser.add_option(tokens_mode, "Print Tokens", "tokens", 'T');
|
||||
args_parser.add_positional_argument(path, "Cpp File", "cpp-file", Core::ArgsParser::Required::No);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Core::ArgsParser args_parser;
|
||||
const char* path = nullptr;
|
||||
char const* path = nullptr;
|
||||
bool print_definitions = false;
|
||||
args_parser.add_positional_argument(path, "File", "file", Core::ArgsParser::Required::Yes);
|
||||
args_parser.add_option(print_definitions, "Print preprocessor definitions", "definitions", 'D');
|
||||
|
|
|
@ -17,12 +17,12 @@ struct Range {
|
|||
size_t m_from { 1 };
|
||||
size_t m_to { SIZE_MAX };
|
||||
|
||||
[[nodiscard]] bool intersects(const Range& other) const
|
||||
[[nodiscard]] bool intersects(Range const& other) const
|
||||
{
|
||||
return !(other.m_from > m_to || other.m_to < m_from);
|
||||
}
|
||||
|
||||
void merge(const Range& other)
|
||||
void merge(Range const& other)
|
||||
{
|
||||
// Can't merge two ranges that are disjoint.
|
||||
VERIFY(intersects(other));
|
||||
|
@ -120,7 +120,7 @@ static bool expand_list(String& list, Vector<Range>& ranges)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void process_line_bytes(char* line, size_t length, const Vector<Range>& ranges)
|
||||
static void process_line_bytes(char* line, size_t length, Vector<Range> const& ranges)
|
||||
{
|
||||
for (auto& i : ranges) {
|
||||
if (i.m_from >= length)
|
||||
|
@ -133,7 +133,7 @@ static void process_line_bytes(char* line, size_t length, const Vector<Range>& r
|
|||
outln();
|
||||
}
|
||||
|
||||
static void process_line_fields(char* line, size_t length, const Vector<Range>& ranges, char delimiter)
|
||||
static void process_line_fields(char* line, size_t length, Vector<Range> const& ranges, char delimiter)
|
||||
{
|
||||
auto string_split = String(line, length).split(delimiter);
|
||||
Vector<String> output_fields;
|
||||
|
|
|
@ -19,7 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool print_iso_8601 = false;
|
||||
bool print_rfc_3339 = false;
|
||||
bool print_rfc_5322 = false;
|
||||
const char* set_date = nullptr;
|
||||
char const* set_date = nullptr;
|
||||
StringView format_string;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const char* usage = "usage:\n"
|
||||
char const* usage = "usage:\n"
|
||||
"\tdd <options>\n"
|
||||
"options:\n"
|
||||
"\tif=<file>\tinput file (default: stdin)\n"
|
||||
|
|
|
@ -26,8 +26,8 @@ public:
|
|||
m_date = date_from_day_of_yold(day);
|
||||
}
|
||||
|
||||
const char* day_of_week() { return m_day_of_week.characters(); };
|
||||
const char* season() { return m_season.characters(); };
|
||||
char const* day_of_week() { return m_day_of_week.characters(); };
|
||||
char const* season() { return m_season.characters(); };
|
||||
uint16_t year() { return yold(); };
|
||||
uint16_t yold() { return m_yold; };
|
||||
uint16_t day_of_year() { return day_of_yold(); };
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
return (day % m_days_in_season == 0 ? m_days_in_season : day % m_days_in_season);
|
||||
}
|
||||
|
||||
const char* day_of_week_from_day_of_yold(uint16_t day)
|
||||
char const* day_of_week_from_day_of_yold(uint16_t day)
|
||||
{
|
||||
if (is_st_tibs_day())
|
||||
return nullptr;
|
||||
|
@ -78,7 +78,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
const char* season_from_day_of_yold(uint16_t day)
|
||||
char const* season_from_day_of_yold(uint16_t day)
|
||||
{
|
||||
if (is_st_tibs_day())
|
||||
return nullptr;
|
||||
|
|
|
@ -27,7 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto file2 = TRY(Core::File::open(filename2, Core::OpenMode::ReadOnly));
|
||||
|
||||
auto hunks = Diff::from_text(file1->read_all(), file2->read_all());
|
||||
for (const auto& hunk : hunks) {
|
||||
for (auto const& hunk : hunks) {
|
||||
auto original_start = hunk.original_start_line;
|
||||
auto target_start = hunk.target_start_line;
|
||||
auto num_added = hunk.added_lines.size();
|
||||
|
@ -55,7 +55,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool color_output = isatty(STDOUT_FILENO);
|
||||
|
||||
outln("Hunk: {}", sb.build());
|
||||
for (const auto& line : hunk.removed_lines) {
|
||||
for (auto const& line : hunk.removed_lines) {
|
||||
if (color_output)
|
||||
outln("\033[31;1m< {}\033[0m", line);
|
||||
else
|
||||
|
@ -63,7 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
if (num_added > 0 && num_removed > 0)
|
||||
outln("---");
|
||||
for (const auto& line : hunk.added_lines) {
|
||||
for (auto const& line : hunk.added_lines) {
|
||||
if (color_output)
|
||||
outln("\033[32;1m> {}\033[0m", line);
|
||||
else
|
||||
|
|
|
@ -24,7 +24,7 @@ struct Result {
|
|||
u64 read_bps {};
|
||||
};
|
||||
|
||||
static Result average_result(const Vector<Result>& results)
|
||||
static Result average_result(Vector<Result> const& results)
|
||||
{
|
||||
Result average;
|
||||
|
||||
|
@ -39,7 +39,7 @@ static Result average_result(const Vector<Result>& results)
|
|||
return average;
|
||||
}
|
||||
|
||||
static ErrorOr<Result> benchmark(const String& filename, int file_size, ByteBuffer& buffer, bool allow_cache);
|
||||
static ErrorOr<Result> benchmark(String const& filename, int file_size, ByteBuffer& buffer, bool allow_cache);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ErrorOr<Result> benchmark(const String& filename, int file_size, ByteBuffer& buffer, bool allow_cache)
|
||||
ErrorOr<Result> benchmark(String const& filename, int file_size, ByteBuffer& buffer, bool allow_cache)
|
||||
{
|
||||
int flags = O_CREAT | O_TRUNC | O_RDWR;
|
||||
if (!allow_cache)
|
||||
|
|
|
@ -35,7 +35,7 @@ struct DuOption {
|
|||
};
|
||||
|
||||
static ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOption& du_option, int& max_depth);
|
||||
static ErrorOr<off_t> print_space_usage(const String& path, const DuOption& du_option, int max_depth, bool inside_dir = false);
|
||||
static ErrorOr<off_t> print_space_usage(String const& path, DuOption const& du_option, int max_depth, bool inside_dir = false);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
TRY(parse_args(arguments, files, du_option, max_depth));
|
||||
|
||||
for (const auto& file : files)
|
||||
for (auto const& file : files)
|
||||
TRY(print_space_usage(file, du_option, max_depth));
|
||||
|
||||
return 0;
|
||||
|
@ -54,8 +54,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOption& du_option, int& max_depth)
|
||||
{
|
||||
bool summarize = false;
|
||||
const char* pattern = nullptr;
|
||||
const char* exclude_from = nullptr;
|
||||
char const* pattern = nullptr;
|
||||
char const* exclude_from = nullptr;
|
||||
Vector<StringView> files_to_process;
|
||||
|
||||
Core::ArgsParser::Option time_option {
|
||||
|
@ -100,7 +100,7 @@ ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOpt
|
|||
du_option.excluded_patterns.append(pattern);
|
||||
if (exclude_from) {
|
||||
auto file = TRY(Core::File::open(exclude_from, Core::OpenMode::ReadOnly));
|
||||
const auto buff = file->read_all();
|
||||
auto const buff = file->read_all();
|
||||
if (!buff.is_empty()) {
|
||||
String patterns = String::copy(buff, Chomp);
|
||||
du_option.excluded_patterns.extend(patterns.split('\n'));
|
||||
|
@ -118,11 +118,11 @@ ErrorOr<void> parse_args(Main::Arguments arguments, Vector<String>& files, DuOpt
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<off_t> print_space_usage(const String& path, const DuOption& du_option, int max_depth, bool inside_dir)
|
||||
ErrorOr<off_t> print_space_usage(String const& path, DuOption const& du_option, int max_depth, bool inside_dir)
|
||||
{
|
||||
struct stat path_stat = TRY(Core::System::lstat(path.characters()));
|
||||
off_t directory_size = 0;
|
||||
const bool is_directory = S_ISDIR(path_stat.st_mode);
|
||||
bool const is_directory = S_ISDIR(path_stat.st_mode);
|
||||
if (--max_depth >= 0 && is_directory) {
|
||||
auto di = Core::DirIterator(path, Core::DirIterator::SkipParentAndBaseDir);
|
||||
if (di.has_error()) {
|
||||
|
@ -131,13 +131,13 @@ ErrorOr<off_t> print_space_usage(const String& path, const DuOption& du_option,
|
|||
}
|
||||
|
||||
while (di.has_next()) {
|
||||
const auto child_path = di.next_full_path();
|
||||
auto const child_path = di.next_full_path();
|
||||
directory_size += TRY(print_space_usage(child_path, du_option, max_depth, true));
|
||||
}
|
||||
}
|
||||
|
||||
const auto basename = LexicalPath::basename(path);
|
||||
for (const auto& pattern : du_option.excluded_patterns) {
|
||||
auto const basename = LexicalPath::basename(path);
|
||||
for (auto const& pattern : du_option.excluded_patterns) {
|
||||
if (basename.matches(pattern, CaseSensitivity::CaseSensitive))
|
||||
return { 0 };
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ ErrorOr<off_t> print_space_usage(const String& path, const DuOption& du_option,
|
|||
break;
|
||||
}
|
||||
|
||||
const auto formatted_time = Core::DateTime::from_timestamp(time).to_string();
|
||||
auto const formatted_time = Core::DateTime::from_timestamp(time).to_string();
|
||||
outln("\t{}\t{}", formatted_time, path);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio"));
|
||||
|
||||
Vector<const char*> text;
|
||||
Vector<char const*> text;
|
||||
bool no_trailing_newline = false;
|
||||
bool should_interpret_backslash_escapes = false;
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio rpath exec"));
|
||||
|
||||
bool ignore_env = false;
|
||||
const char* split_string = nullptr;
|
||||
Vector<const char*> values;
|
||||
char const* split_string = nullptr;
|
||||
Vector<char const*> values;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_stop_on_first_non_option(true);
|
||||
|
@ -42,7 +42,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
Vector<String> split_string_storage;
|
||||
Vector<const char*> new_argv;
|
||||
Vector<char const*> new_argv;
|
||||
if (split_string) {
|
||||
for (auto view : StringView(split_string).split_view(' ')) {
|
||||
split_string_storage.append(view);
|
||||
|
@ -65,7 +65,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
new_argv.append(nullptr);
|
||||
|
||||
const char* executable = new_argv[0];
|
||||
char const* executable = new_argv[0];
|
||||
char* const* new_argv_ptr = const_cast<char* const*>(&new_argv[0]);
|
||||
|
||||
execvp(executable, new_argv_ptr);
|
||||
|
|
|
@ -388,7 +388,7 @@ private:
|
|||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
static auto safe_substring(const String& str, int start, int length)
|
||||
static auto safe_substring(String const& str, int start, int length)
|
||||
{
|
||||
if (start < 1 || (size_t)start > str.length())
|
||||
fail("Index out of range");
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static Optional<String> description_only(String description, [[maybe_unused]] const String& path)
|
||||
static Optional<String> description_only(String description, [[maybe_unused]] String const& path)
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
// FIXME: Ideally Gfx::ImageDecoder could tell us the image type directly.
|
||||
static Optional<String> image_details(const String& description, const String& path)
|
||||
static Optional<String> image_details(String const& description, String const& path)
|
||||
{
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
|
@ -39,7 +39,7 @@ static Optional<String> image_details(const String& description, const String& p
|
|||
return String::formatted("{}, {} x {}", description, image_decoder->width(), image_decoder->height());
|
||||
}
|
||||
|
||||
static Optional<String> gzip_details(String description, const String& path)
|
||||
static Optional<String> gzip_details(String description, String const& path)
|
||||
{
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
|
@ -56,7 +56,7 @@ static Optional<String> gzip_details(String description, const String& path)
|
|||
return String::formatted("{}, {}", description, gzip_details.value());
|
||||
}
|
||||
|
||||
static Optional<String> elf_details(String description, const String& path)
|
||||
static Optional<String> elf_details(String description, String const& path)
|
||||
{
|
||||
auto file_or_error = Core::MappedFile::map(path);
|
||||
if (file_or_error.is_error())
|
||||
|
@ -127,7 +127,7 @@ static Optional<String> elf_details(String description, const String& path)
|
|||
__ENUMERATE_MIME_TYPE_DESCRIPTION("text/markdown", "Markdown document", description_only) \
|
||||
__ENUMERATE_MIME_TYPE_DESCRIPTION("text/x-shellscript", "POSIX shell script text executable", description_only)
|
||||
|
||||
static Optional<String> get_description_from_mime_type(const String& mime, const String& path)
|
||||
static Optional<String> get_description_from_mime_type(String const& mime, String const& path)
|
||||
{
|
||||
#define __ENUMERATE_MIME_TYPE_DESCRIPTION(mime_type, description, details) \
|
||||
if (String(mime_type) == mime) \
|
||||
|
@ -141,7 +141,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
Vector<const char*> paths;
|
||||
Vector<char const*> paths;
|
||||
bool flag_mime_only = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
|
@ -44,7 +44,7 @@ struct FileData {
|
|||
// The parent directory of the file.
|
||||
int dirfd { -1 };
|
||||
// The file's basename, relative to the directory.
|
||||
const char* basename { nullptr };
|
||||
char const* basename { nullptr };
|
||||
// Optionally, cached information as returned by stat/lstat/fstatat.
|
||||
struct stat stat {
|
||||
};
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
|
||||
class TypeCommand final : public Command {
|
||||
public:
|
||||
TypeCommand(const char* arg)
|
||||
TypeCommand(char const* arg)
|
||||
{
|
||||
StringView type = arg;
|
||||
if (type.length() != 1 || !StringView("bcdlpfs").contains(type[0]))
|
||||
|
@ -155,7 +155,7 @@ private:
|
|||
|
||||
class LinksCommand final : public StatCommand {
|
||||
public:
|
||||
LinksCommand(const char* arg)
|
||||
LinksCommand(char const* arg)
|
||||
{
|
||||
auto number = StringView(arg).to_uint();
|
||||
if (!number.has_value())
|
||||
|
@ -174,7 +174,7 @@ private:
|
|||
|
||||
class UserCommand final : public StatCommand {
|
||||
public:
|
||||
UserCommand(const char* arg)
|
||||
UserCommand(char const* arg)
|
||||
{
|
||||
if (struct passwd* passwd = getpwnam(arg)) {
|
||||
m_uid = passwd->pw_uid;
|
||||
|
@ -198,7 +198,7 @@ private:
|
|||
|
||||
class GroupCommand final : public StatCommand {
|
||||
public:
|
||||
GroupCommand(const char* arg)
|
||||
GroupCommand(char const* arg)
|
||||
{
|
||||
if (struct group* gr = getgrnam(arg)) {
|
||||
m_gid = gr->gr_gid;
|
||||
|
@ -222,7 +222,7 @@ private:
|
|||
|
||||
class SizeCommand final : public StatCommand {
|
||||
public:
|
||||
SizeCommand(const char* arg)
|
||||
SizeCommand(char const* arg)
|
||||
{
|
||||
StringView view = arg;
|
||||
if (view.ends_with('c')) {
|
||||
|
@ -251,7 +251,7 @@ private:
|
|||
|
||||
class NameCommand : public Command {
|
||||
public:
|
||||
NameCommand(const char* pattern, CaseSensitivity case_sensitivity)
|
||||
NameCommand(char const* pattern, CaseSensitivity case_sensitivity)
|
||||
: m_pattern(pattern)
|
||||
, m_case_sensitivity(case_sensitivity)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
class Quote {
|
||||
public:
|
||||
static Optional<Quote> try_parse(const JsonValue& value)
|
||||
static Optional<Quote> try_parse(JsonValue const& value)
|
||||
{
|
||||
if (!value.is_object())
|
||||
return {};
|
||||
|
@ -41,11 +41,11 @@ public:
|
|||
return q;
|
||||
}
|
||||
|
||||
const String& quote() const { return m_quote; }
|
||||
const String& author() const { return m_author; }
|
||||
const u64& utc_time() const { return m_utc_time; }
|
||||
const String& url() const { return m_url; }
|
||||
const Optional<String>& context() const { return m_context; }
|
||||
String const& quote() const { return m_quote; }
|
||||
String const& author() const { return m_author; }
|
||||
u64 const& utc_time() const { return m_utc_time; }
|
||||
String const& url() const { return m_url; }
|
||||
Optional<String> const& context() const { return m_context; }
|
||||
|
||||
private:
|
||||
Quote() = default;
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
Optional<String> m_context;
|
||||
};
|
||||
|
||||
static Vector<Quote> parse_all(const JsonArray& array)
|
||||
static Vector<Quote> parse_all(JsonArray const& array)
|
||||
{
|
||||
Vector<Quote> quotes;
|
||||
for (size_t i = 0; i < array.size(); ++i) {
|
||||
|
@ -75,7 +75,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
const char* path = "/res/fortunes.json";
|
||||
char const* path = "/res/fortunes.json";
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Open a fortune cookie, receive a free quote for the day!");
|
||||
|
@ -94,14 +94,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
const auto quotes = parse_all(json.as_array());
|
||||
auto const quotes = parse_all(json.as_array());
|
||||
if (quotes.is_empty()) {
|
||||
warnln("{} does not contain any valid quotes", path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
u32 i = get_random_uniform(quotes.size());
|
||||
const auto& chosen_quote = quotes[i];
|
||||
auto const& chosen_quote = quotes[i];
|
||||
auto datetime = Core::DateTime::from_timestamp(chosen_quote.utc_time());
|
||||
|
||||
outln(); // Tasteful spacing
|
||||
|
|
|
@ -71,7 +71,7 @@ static void print_syscall(PtraceRegisters& regs, size_t depth)
|
|||
static NonnullOwnPtr<HashMap<FlatPtr, X86::Instruction>> instrument_code()
|
||||
{
|
||||
auto instrumented = make<HashMap<FlatPtr, X86::Instruction>>();
|
||||
g_debug_session->for_each_loaded_library([&](const Debug::LoadedLibrary& lib) {
|
||||
g_debug_session->for_each_loaded_library([&](Debug::LoadedLibrary const& lib) {
|
||||
lib.debug_info->elf().for_each_section_of_type(SHT_PROGBITS, [&](const ELF::Image::Section& section) {
|
||||
if (section.name() != ".text")
|
||||
return IterationDecision::Continue;
|
||||
|
|
|
@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
#endif
|
||||
|
||||
bool inplace = false;
|
||||
Vector<const char*> files;
|
||||
Vector<char const*> files;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Format GML files.");
|
||||
|
|
|
@ -39,11 +39,11 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
|
||||
String program_name = AK::LexicalPath::basename(args.strings[0]);
|
||||
|
||||
Vector<const char*> files;
|
||||
Vector<char const*> files;
|
||||
|
||||
bool recursive = (program_name == "rgrep"sv);
|
||||
bool use_ere = (program_name == "egrep"sv);
|
||||
Vector<const char*> patterns;
|
||||
Vector<char const*> patterns;
|
||||
BinaryFileMode binary_mode { BinaryFileMode::Binary };
|
||||
bool case_insensitive = false;
|
||||
bool line_numbers = false;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <grp.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void print_account_gids(const Core::Account& account)
|
||||
static void print_account_gids(Core::Account const& account)
|
||||
{
|
||||
auto* gr = getgrgid(account.gid());
|
||||
if (!gr) {
|
||||
|
@ -35,7 +35,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio rpath", nullptr));
|
||||
|
||||
Vector<const char*> usernames;
|
||||
Vector<char const*> usernames;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Print group memberships for each username or, if no username is specified, for the current process.");
|
||||
|
|
|
@ -18,7 +18,7 @@ static bool decompress_file(Buffered<Core::InputFileStream>& input_stream, Buffe
|
|||
u8 buffer[4096];
|
||||
|
||||
while (!gzip_stream.has_any_error() && !gzip_stream.unreliable_eof()) {
|
||||
const auto nread = gzip_stream.read({ buffer, sizeof(buffer) });
|
||||
auto const nread = gzip_stream.read({ buffer, sizeof(buffer) });
|
||||
output_stream.write_or_error({ buffer, nread });
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int head(const String& filename, bool print_filename, ssize_t line_count, ssize_t byte_count);
|
||||
int head(String const& filename, bool print_filename, ssize_t line_count, ssize_t byte_count);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments args)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
int byte_count = -1;
|
||||
bool never_print_filenames = false;
|
||||
bool always_print_filenames = false;
|
||||
Vector<const char*> files;
|
||||
Vector<char const*> files;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Print the beginning ('head') of a file.");
|
||||
|
@ -60,7 +60,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
return rc;
|
||||
}
|
||||
|
||||
int head(const String& filename, bool print_filename, ssize_t line_count, ssize_t byte_count)
|
||||
int head(String const& filename, bool print_filename, ssize_t line_count, ssize_t byte_count)
|
||||
{
|
||||
bool is_stdin = false;
|
||||
int fd = -1;
|
||||
|
@ -114,7 +114,7 @@ int head(const String& filename, bool print_filename, ssize_t line_count, ssize_
|
|||
// Count line breaks.
|
||||
ntowrite = 0;
|
||||
while (line_count) {
|
||||
const char* newline = strchr(buffer + ntowrite, '\n');
|
||||
char const* newline = strchr(buffer + ntowrite, '\n');
|
||||
if (newline) {
|
||||
// Found another line break, include this line.
|
||||
ntowrite = newline - buffer + 1;
|
||||
|
|
|
@ -22,7 +22,7 @@ enum class State {
|
|||
ErrorOr<int> serenity_main(Main::Arguments args)
|
||||
{
|
||||
Core::ArgsParser args_parser;
|
||||
const char* path = nullptr;
|
||||
char const* path = nullptr;
|
||||
bool verbose = false;
|
||||
args_parser.add_positional_argument(path, "Input", "input", Core::ArgsParser::Required::No);
|
||||
args_parser.add_option(verbose, "Display all input data", "verbose", 'v');
|
||||
|
|
|
@ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio unix", nullptr));
|
||||
|
||||
const char* name_or_ip = nullptr;
|
||||
char const* name_or_ip = nullptr;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Convert between domain name and IPv4 address.");
|
||||
args_parser.add_positional_argument(name_or_ip, "Domain name or IPv4 address", "name");
|
||||
|
@ -46,7 +46,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
}
|
||||
|
||||
char buffer[INET_ADDRSTRLEN];
|
||||
const char* ip_str = inet_ntop(AF_INET, hostent->h_addr_list[0], buffer, sizeof(buffer));
|
||||
char const* ip_str = inet_ntop(AF_INET, hostent->h_addr_list[0], buffer, sizeof(buffer));
|
||||
|
||||
outln("{} is {}", name_or_ip, ip_str);
|
||||
return 0;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments args)
|
||||
{
|
||||
const char* hostname = nullptr;
|
||||
char const* hostname = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(hostname, "Hostname to set", "hostname", Core::ArgsParser::Required::No);
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
const char* value_ipv4 = nullptr;
|
||||
const char* value_adapter = nullptr;
|
||||
const char* value_gateway = nullptr;
|
||||
const char* value_mask = nullptr;
|
||||
char const* value_ipv4 = nullptr;
|
||||
char const* value_adapter = nullptr;
|
||||
char const* value_gateway = nullptr;
|
||||
char const* value_mask = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Display or modify the configuration of each network interface.");
|
||||
|
|
|
@ -14,10 +14,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath wpath cpath"));
|
||||
|
||||
const char* path = nullptr;
|
||||
const char* group = nullptr;
|
||||
const char* key = nullptr;
|
||||
const char* value_to_write = nullptr;
|
||||
char const* path = nullptr;
|
||||
char const* group = nullptr;
|
||||
char const* key = nullptr;
|
||||
char const* value_to_write = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(path, "Path to INI file", "path");
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <LibMain/Main.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void print(const JsonValue& value, int spaces_per_indent, int indent = 0, bool use_color = true);
|
||||
static void print(JsonValue const& value, int spaces_per_indent, int indent = 0, bool use_color = true);
|
||||
static void print_indent(int indent, int spaces_per_indent)
|
||||
{
|
||||
for (int i = 0; i < indent * spaces_per_indent; ++i)
|
||||
|
@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void print(const JsonValue& value, int spaces_per_indent, int indent, bool use_color)
|
||||
void print(JsonValue const& value, int spaces_per_indent, int indent, bool use_color)
|
||||
{
|
||||
if (value.is_object()) {
|
||||
size_t printed_members = 0;
|
||||
|
|
|
@ -229,7 +229,7 @@ static String strip_ansi(StringView format_string)
|
|||
}
|
||||
|
||||
template<typename... Parameters>
|
||||
static void js_out(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
|
||||
static void js_out(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters)
|
||||
{
|
||||
if (!s_strip_ansi)
|
||||
return out(move(fmtstr), parameters...);
|
||||
|
@ -238,7 +238,7 @@ static void js_out(CheckedFormatString<Parameters...>&& fmtstr, const Parameters
|
|||
}
|
||||
|
||||
template<typename... Parameters>
|
||||
static void js_outln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters)
|
||||
static void js_outln(CheckedFormatString<Parameters...>&& fmtstr, Parameters const&... parameters)
|
||||
{
|
||||
if (!s_strip_ansi)
|
||||
return outln(move(fmtstr), parameters...);
|
||||
|
|
|
@ -19,7 +19,7 @@ static void print_usage_and_exit()
|
|||
exit(1);
|
||||
}
|
||||
|
||||
static ErrorOr<int> kill_all(const String& process_name, const unsigned signum)
|
||||
static ErrorOr<int> kill_all(String const& process_name, unsigned const signum)
|
||||
{
|
||||
auto all_processes = Core::ProcessStatisticsReader::get_all();
|
||||
if (!all_processes.has_value())
|
||||
|
|
|
@ -587,7 +587,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
continue;
|
||||
}
|
||||
|
||||
const auto& sequence = sequence_value.value();
|
||||
auto const& sequence = sequence_value.value();
|
||||
|
||||
if (sequence.to_uint().has_value()) {
|
||||
modifier_buffer.append(sequence);
|
||||
|
|
|
@ -16,8 +16,8 @@ ErrorOr<int> serenity_main(Main::Arguments argmuments)
|
|||
|
||||
bool force = false;
|
||||
bool symbolic = false;
|
||||
const char* target = nullptr;
|
||||
const char* path = nullptr;
|
||||
char const* target = nullptr;
|
||||
char const* path = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(force, "Force the creation", "force", 'f');
|
||||
|
|
|
@ -42,10 +42,10 @@ struct FileMetadata {
|
|||
};
|
||||
};
|
||||
|
||||
static int do_file_system_object_long(const char* path);
|
||||
static int do_file_system_object_short(const char* path);
|
||||
static int do_file_system_object_long(char const* path);
|
||||
static int do_file_system_object_short(char const* path);
|
||||
|
||||
static bool print_names(const char* path, size_t longest_name, const Vector<FileMetadata>& files);
|
||||
static bool print_names(char const* path, size_t longest_name, Vector<FileMetadata> const& files);
|
||||
|
||||
static bool filemetadata_comparator(FileMetadata& a, FileMetadata& b);
|
||||
|
||||
|
@ -136,7 +136,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
endgrent();
|
||||
}
|
||||
|
||||
auto do_file_system_object = [&](const char* path) {
|
||||
auto do_file_system_object = [&](char const* path) {
|
||||
if (flag_long)
|
||||
return do_file_system_object_long(path);
|
||||
return do_file_system_object_short(path);
|
||||
|
@ -235,7 +235,7 @@ static String& hostname()
|
|||
return s_hostname;
|
||||
}
|
||||
|
||||
static size_t print_name(const struct stat& st, const String& name, const char* path_for_link_resolution, const char* path_for_hyperlink)
|
||||
static size_t print_name(const struct stat& st, String const& name, char const* path_for_link_resolution, char const* path_for_hyperlink)
|
||||
{
|
||||
if (!flag_disable_hyperlinks) {
|
||||
auto full_path = Core::File::real_path_for(path_for_hyperlink);
|
||||
|
@ -250,8 +250,8 @@ static size_t print_name(const struct stat& st, const String& name, const char*
|
|||
if (!flag_colorize || !output_is_terminal) {
|
||||
nprinted = printf("%s", name.characters());
|
||||
} else {
|
||||
const char* begin_color = "";
|
||||
const char* end_color = "\033[0m";
|
||||
char const* begin_color = "";
|
||||
char const* end_color = "\033[0m";
|
||||
|
||||
if (st.st_mode & S_ISVTX)
|
||||
begin_color = "\033[42;30;1m";
|
||||
|
@ -300,7 +300,7 @@ static size_t print_name(const struct stat& st, const String& name, const char*
|
|||
return nprinted;
|
||||
}
|
||||
|
||||
static bool print_filesystem_object(const String& path, const String& name, const struct stat& st)
|
||||
static bool print_filesystem_object(String const& path, String const& name, const struct stat& st)
|
||||
{
|
||||
if (flag_show_inode)
|
||||
printf("%s ", String::formatted("{}", st.st_ino).characters());
|
||||
|
@ -373,7 +373,7 @@ static bool print_filesystem_object(const String& path, const String& name, cons
|
|||
return true;
|
||||
}
|
||||
|
||||
static int do_file_system_object_long(const char* path)
|
||||
static int do_file_system_object_long(char const* path)
|
||||
{
|
||||
if (flag_list_directories_only) {
|
||||
struct stat stat {
|
||||
|
@ -440,7 +440,7 @@ static int do_file_system_object_long(const char* path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool print_filesystem_object_short(const char* path, const char* name, size_t* nprinted)
|
||||
static bool print_filesystem_object_short(char const* path, char const* name, size_t* nprinted)
|
||||
{
|
||||
struct stat st;
|
||||
int rc = lstat(path, &st);
|
||||
|
@ -456,7 +456,7 @@ static bool print_filesystem_object_short(const char* path, const char* name, si
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool print_names(const char* path, size_t longest_name, const Vector<FileMetadata>& files)
|
||||
static bool print_names(char const* path, size_t longest_name, Vector<FileMetadata> const& files)
|
||||
{
|
||||
size_t printed_on_row = 0;
|
||||
size_t nprinted = 0;
|
||||
|
@ -490,7 +490,7 @@ static bool print_names(const char* path, size_t longest_name, const Vector<File
|
|||
return printed_on_row;
|
||||
}
|
||||
|
||||
int do_file_system_object_short(const char* path)
|
||||
int do_file_system_object_short(char const* path)
|
||||
{
|
||||
if (flag_list_directories_only) {
|
||||
size_t nprinted = 0;
|
||||
|
|
|
@ -80,7 +80,7 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid)
|
|||
auto json = json_or_error.release_value();
|
||||
|
||||
Vector<OpenFile> files;
|
||||
json.as_array().for_each([pid, &files](const JsonValue& object) {
|
||||
json.as_array().for_each([pid, &files](JsonValue const& object) {
|
||||
OpenFile open_file;
|
||||
open_file.pid = pid;
|
||||
open_file.fd = object.as_object().get("fd").to_int();
|
||||
|
@ -94,7 +94,7 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid)
|
|||
return files;
|
||||
}
|
||||
|
||||
static void display_entry(const OpenFile& file, const Core::ProcessStatistics& statistics)
|
||||
static void display_entry(OpenFile const& file, Core::ProcessStatistics const& statistics)
|
||||
{
|
||||
outln("{:28} {:>4} {:>4} {:10} {:>4} {}", statistics.name, file.pid, statistics.pgid, statistics.username, file.fd, file.full_name);
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/bin", "x"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
const char* section = nullptr;
|
||||
const char* name = nullptr;
|
||||
const char* pager = nullptr;
|
||||
char const* section = nullptr;
|
||||
char const* name = nullptr;
|
||||
char const* pager = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Read manual pages. Try 'man man' to get started.");
|
||||
|
@ -70,11 +70,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(pager, "Pager to pipe the man page to", "pager", 'P', "pager");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto make_path = [name](const char* section) {
|
||||
auto make_path = [name](char const* section) {
|
||||
return String::formatted("/usr/share/man/man{}/{}.md", section, name);
|
||||
};
|
||||
if (!section) {
|
||||
const char* sections[] = {
|
||||
char const* sections[] = {
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
|
|
|
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath tty"));
|
||||
|
||||
const char* filename = nullptr;
|
||||
char const* filename = nullptr;
|
||||
bool html = false;
|
||||
int view_width = 0;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
bool create_parents = false;
|
||||
String mode_string;
|
||||
Vector<const char*> directories;
|
||||
Vector<char const*> directories;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(create_parents, "Create parent directories if they don't exist", "parents", 'p');
|
||||
|
|
|
@ -76,7 +76,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
target_directory = getcwd(nullptr, 0);
|
||||
} else {
|
||||
LexicalPath template_path(file_template);
|
||||
const char* env_directory = getenv("TMPDIR");
|
||||
char const* env_directory = getenv("TMPDIR");
|
||||
target_directory = env_directory && *env_directory ? env_directory : "/tmp";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool force = false;
|
||||
bool verbose = false;
|
||||
|
||||
Vector<const char*> paths;
|
||||
Vector<char const*> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(force, "Force", "force", 'f');
|
||||
|
@ -57,7 +57,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
for (auto& old_path : paths) {
|
||||
String combined_new_path;
|
||||
const char* new_path = original_new_path;
|
||||
char const* new_path = original_new_path;
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
auto old_basename = LexicalPath::basename(old_path);
|
||||
combined_new_path = String::formatted("{}/{}", original_new_path, old_basename);
|
||||
|
|
|
@ -50,7 +50,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool verbose = false;
|
||||
bool should_close = false;
|
||||
bool udp_mode = false;
|
||||
const char* target = nullptr;
|
||||
char const* target = nullptr;
|
||||
int port = 0;
|
||||
int maximum_tcp_receive_buffer_size_input = -1;
|
||||
|
||||
|
@ -135,7 +135,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
sockaddr_in dst_addr {};
|
||||
dst_addr.sin_family = AF_INET;
|
||||
dst_addr.sin_port = htons(port);
|
||||
dst_addr.sin_addr.s_addr = *(const in_addr_t*)hostent->h_addr_list[0];
|
||||
dst_addr.sin_addr.s_addr = *(in_addr_t const*)hostent->h_addr_list[0];
|
||||
|
||||
if (verbose) {
|
||||
char addr_str[INET_ADDRSTRLEN];
|
||||
|
|
|
@ -22,10 +22,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
NumberStyle number_style = NumberNonEmptyLines;
|
||||
int increment = 1;
|
||||
const char* separator = " ";
|
||||
char const* separator = " ";
|
||||
int start_number = 1;
|
||||
int number_width = 6;
|
||||
Vector<const char*> files;
|
||||
Vector<char const*> files;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
||||
|
@ -35,7 +35,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
"body-numbering",
|
||||
'b',
|
||||
"style",
|
||||
[&number_style](const char* s) {
|
||||
[&number_style](char const* s) {
|
||||
if (!strcmp(s, "t"))
|
||||
number_style = NumberNonEmptyLines;
|
||||
else if (!strcmp(s, "a"))
|
||||
|
|
|
@ -15,9 +15,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
const char* title = nullptr;
|
||||
const char* message = nullptr;
|
||||
const char* icon_path = nullptr;
|
||||
char const* title = nullptr;
|
||||
char const* message = nullptr;
|
||||
char const* icon_path = nullptr;
|
||||
args_parser.add_positional_argument(title, "Title of the notification", "title");
|
||||
args_parser.add_positional_argument(message, "Message to display in the notification", "message");
|
||||
args_parser.add_positional_argument(icon_path, "Path of icon to display in the notification", "icon-path", Core::ArgsParser::Required::No);
|
||||
|
|
|
@ -53,9 +53,9 @@ static_assert(AssertSize<NtpPacket, 48>());
|
|||
// NTP measures time in seconds since 1900-01-01, POSIX in seconds since 1970-01-01.
|
||||
// 1900 wasn't a leap year, so there are 70/4 leap years between 1900 and 1970.
|
||||
// Overflows a 32-bit signed int, but not a 32-bit unsigned int.
|
||||
const unsigned SecondsFrom1900To1970 = (70u * 365u + 70u / 4u) * 24u * 60u * 60u;
|
||||
unsigned const SecondsFrom1900To1970 = (70u * 365u + 70u / 4u) * 24u * 60u * 60u;
|
||||
|
||||
static NtpTimestamp ntp_timestamp_from_timeval(const timeval& t)
|
||||
static NtpTimestamp ntp_timestamp_from_timeval(timeval const& t)
|
||||
{
|
||||
VERIFY(t.tv_usec >= 0 && t.tv_usec < 1'000'000); // Fits in 20 bits when normalized.
|
||||
|
||||
|
@ -68,7 +68,7 @@ static NtpTimestamp ntp_timestamp_from_timeval(const timeval& t)
|
|||
return (static_cast<NtpTimestamp>(seconds) << 32) | fractional_bits;
|
||||
}
|
||||
|
||||
static timeval timeval_from_ntp_timestamp(const NtpTimestamp& ntp_timestamp)
|
||||
static timeval timeval_from_ntp_timestamp(NtpTimestamp const& ntp_timestamp)
|
||||
{
|
||||
timeval t;
|
||||
t.tv_sec = static_cast<time_t>(ntp_timestamp >> 32) - SecondsFrom1900To1970;
|
||||
|
@ -113,7 +113,7 @@ int main(int argc, char** argv)
|
|||
// Leap seconds smearing NTP servers:
|
||||
// - time.facebook.com , https://engineering.fb.com/production-engineering/ntp-service/ , sine-smears over 18 hours
|
||||
// - time.google.com , https://developers.google.com/time/smear , linear-smears over 24 hours
|
||||
const char* host = "time.google.com";
|
||||
char const* host = "time.google.com";
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(adjust_time, "Gradually adjust system time (requires root)", "adjust", 'a');
|
||||
args_parser.add_option(set_time, "Immediately set system time (requires root)", "set", 's');
|
||||
|
@ -171,7 +171,7 @@ int main(int argc, char** argv)
|
|||
memset(&peer_address, 0, sizeof(peer_address));
|
||||
peer_address.sin_family = AF_INET;
|
||||
peer_address.sin_port = htons(123);
|
||||
peer_address.sin_addr.s_addr = *(const in_addr_t*)hostent->h_addr_list[0];
|
||||
peer_address.sin_addr.s_addr = *(in_addr_t const*)hostent->h_addr_list[0];
|
||||
|
||||
NtpPacket packet;
|
||||
memset(&packet, 0, sizeof(packet));
|
||||
|
|
|
@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool del = false;
|
||||
bool lock = false;
|
||||
bool unlock = false;
|
||||
const char* username = nullptr;
|
||||
char const* username = nullptr;
|
||||
|
||||
auto args_parser = Core::ArgsParser();
|
||||
args_parser.set_general_help("Modify an account password.");
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void spawn_command(const Vector<const char*>& command, const ByteBuffer& data, const char* state)
|
||||
static void spawn_command(Vector<char const*> const& command, ByteBuffer const& data, char const* state)
|
||||
{
|
||||
auto pipefd = MUST(Core::System::pipe2(0));
|
||||
pid_t pid = MUST(Core::System::fork());
|
||||
|
@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool print_type = false;
|
||||
bool no_newline = false;
|
||||
bool watch = false;
|
||||
Vector<const char*> watch_command;
|
||||
Vector<char const*> watch_command;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Paste from the clipboard to stdout.");
|
||||
|
@ -70,7 +70,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (watch) {
|
||||
watch_command.append(nullptr);
|
||||
|
||||
clipboard.on_change = [&](const String&) {
|
||||
clipboard.on_change = [&](String const&) {
|
||||
// Technically there's a race here...
|
||||
auto data_and_type = clipboard.fetch_data_and_type();
|
||||
if (data_and_type.mime_type.is_null()) {
|
||||
|
|
|
@ -19,7 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
static bool flag_most_posix = false;
|
||||
static bool flag_portability = false;
|
||||
static bool flag_empty_name_and_leading_dash = false;
|
||||
Vector<const char*> paths;
|
||||
Vector<char const*> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(flag_most_posix, "Check for most POSIX systems", nullptr, 'p');
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static ErrorOr<int> pid_of(const String& process_name, bool single_shot, bool omit_pid, pid_t pid)
|
||||
static ErrorOr<int> pid_of(String const& process_name, bool single_shot, bool omit_pid, pid_t pid)
|
||||
{
|
||||
bool displayed_at_least_one = false;
|
||||
|
||||
|
@ -48,8 +48,8 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
bool single_shot = false;
|
||||
const char* omit_pid_value = nullptr;
|
||||
const char* process_name = nullptr;
|
||||
char const* omit_pid_value = nullptr;
|
||||
char const* process_name = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(single_shot, "Only return one pid", nullptr, 's');
|
||||
|
|
|
@ -30,7 +30,7 @@ static Optional<size_t> count;
|
|||
static uint32_t total_ms;
|
||||
static int min_ms;
|
||||
static int max_ms;
|
||||
static const char* host;
|
||||
static char const* host;
|
||||
static int payload_size = -1;
|
||||
// variable part of header can be 0 to 40 bytes
|
||||
// https://datatracker.ietf.org/doc/html/rfc791#section-3.1
|
||||
|
@ -101,7 +101,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
sockaddr_in peer_address {};
|
||||
peer_address.sin_family = AF_INET;
|
||||
peer_address.sin_port = 0;
|
||||
peer_address.sin_addr.s_addr = *(const in_addr_t*)hostent->h_addr_list[0];
|
||||
peer_address.sin_addr.s_addr = *(in_addr_t const*)hostent->h_addr_list[0];
|
||||
|
||||
uint16_t seq = 1;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/proc", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
const char* pid;
|
||||
char const* pid;
|
||||
static bool extended = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
[[gnu::noreturn]] static void fail(const char* message)
|
||||
[[gnu::noreturn]] static void fail(char const* message)
|
||||
{
|
||||
fputs("\e[31m", stderr);
|
||||
fputs(message, stderr);
|
||||
|
@ -23,15 +23,15 @@
|
|||
|
||||
template<typename PutChFunc, typename ArgumentListRefT, template<typename T, typename U = ArgumentListRefT> typename NextArgument, typename CharType>
|
||||
requires(IsSame<CharType, char>) struct PrintfImpl : public PrintfImplementation::PrintfImpl<PutChFunc, ArgumentListRefT, NextArgument, CharType> {
|
||||
ALWAYS_INLINE PrintfImpl(PutChFunc& putch, char*& bufptr, const int& nwritten)
|
||||
ALWAYS_INLINE PrintfImpl(PutChFunc& putch, char*& bufptr, int const& nwritten)
|
||||
: PrintfImplementation::PrintfImpl<PutChFunc, ArgumentListRefT, NextArgument>(putch, bufptr, nwritten)
|
||||
{
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int format_q(const PrintfImplementation::ModifierState& state, ArgumentListRefT& ap) const
|
||||
ALWAYS_INLINE int format_q(PrintfImplementation::ModifierState const& state, ArgumentListRefT& ap) const
|
||||
{
|
||||
auto state_copy = state;
|
||||
auto str = NextArgument<const char*>()(ap);
|
||||
auto str = NextArgument<char const*>()(ap);
|
||||
if (!str)
|
||||
str = "(null)";
|
||||
|
||||
|
@ -106,8 +106,8 @@ struct ArgvNextArgument<char*, V> {
|
|||
};
|
||||
|
||||
template<typename V>
|
||||
struct ArgvNextArgument<const char*, V> {
|
||||
ALWAYS_INLINE const char* operator()(V arg) const
|
||||
struct ArgvNextArgument<char const*, V> {
|
||||
ALWAYS_INLINE char const* operator()(V arg) const
|
||||
{
|
||||
if (arg.argc == 0)
|
||||
return "";
|
||||
|
@ -119,8 +119,8 @@ struct ArgvNextArgument<const char*, V> {
|
|||
};
|
||||
|
||||
template<typename V>
|
||||
struct ArgvNextArgument<const wchar_t*, V> {
|
||||
ALWAYS_INLINE const wchar_t* operator()(V arg) const
|
||||
struct ArgvNextArgument<wchar_t const*, V> {
|
||||
ALWAYS_INLINE wchar_t const* operator()(V arg) const
|
||||
{
|
||||
if (arg.argc == 0)
|
||||
return L"";
|
||||
|
@ -208,7 +208,7 @@ struct ArgvWithCount {
|
|||
int& argc;
|
||||
};
|
||||
|
||||
static String handle_escapes(const char* string)
|
||||
static String handle_escapes(char const* string)
|
||||
{
|
||||
StringBuilder builder;
|
||||
for (auto c = *string; c; c = *++string) {
|
||||
|
|
|
@ -147,10 +147,10 @@ private:
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
const char* url_str = nullptr;
|
||||
char const* url_str = nullptr;
|
||||
bool save_at_provided_name = false;
|
||||
bool should_follow_url = false;
|
||||
const char* data = nullptr;
|
||||
char const* data = nullptr;
|
||||
String method = "GET";
|
||||
HashMap<String, String, CaseInsensitiveStringTraits> request_headers;
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
Core::ArgsParser args_parser;
|
||||
|
||||
const char* pid_argument = nullptr;
|
||||
const char* cmd_argument = nullptr;
|
||||
char const* pid_argument = nullptr;
|
||||
char const* cmd_argument = nullptr;
|
||||
bool wait = false;
|
||||
bool free = false;
|
||||
bool enable = false;
|
||||
|
@ -108,7 +108,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
auto cmd_parts = String(cmd_argument).split(' ');
|
||||
Vector<const char*> cmd_argv;
|
||||
Vector<char const*> cmd_argv;
|
||||
|
||||
for (auto& part : cmd_parts)
|
||||
cmd_argv.append(part.characters());
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static const char* object_program_header_type_to_string(ElfW(Word) type)
|
||||
static char const* object_program_header_type_to_string(ElfW(Word) type)
|
||||
{
|
||||
switch (type) {
|
||||
case PT_NULL:
|
||||
|
@ -65,7 +65,7 @@ static const char* object_program_header_type_to_string(ElfW(Word) type)
|
|||
}
|
||||
}
|
||||
|
||||
static const char* object_section_header_type_to_string(ElfW(Word) type)
|
||||
static char const* object_section_header_type_to_string(ElfW(Word) type)
|
||||
{
|
||||
switch (type) {
|
||||
case SHT_NULL:
|
||||
|
@ -137,7 +137,7 @@ static const char* object_section_header_type_to_string(ElfW(Word) type)
|
|||
}
|
||||
}
|
||||
|
||||
static const char* object_symbol_type_to_string(ElfW(Word) type)
|
||||
static char const* object_symbol_type_to_string(ElfW(Word) type)
|
||||
{
|
||||
switch (type) {
|
||||
case STT_NOTYPE:
|
||||
|
@ -161,7 +161,7 @@ static const char* object_symbol_type_to_string(ElfW(Word) type)
|
|||
}
|
||||
}
|
||||
|
||||
static const char* object_symbol_binding_to_string(ElfW(Word) type)
|
||||
static char const* object_symbol_binding_to_string(ElfW(Word) type)
|
||||
{
|
||||
switch (type) {
|
||||
case STB_LOCAL:
|
||||
|
@ -181,7 +181,7 @@ static const char* object_symbol_binding_to_string(ElfW(Word) type)
|
|||
}
|
||||
}
|
||||
|
||||
static const char* object_relocation_type_to_string(ElfW(Word) type)
|
||||
static char const* object_relocation_type_to_string(ElfW(Word) type)
|
||||
{
|
||||
switch (type) {
|
||||
#if ARCH(I386)
|
||||
|
@ -230,7 +230,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
const char* path;
|
||||
char const* path;
|
||||
static bool display_all = false;
|
||||
static bool display_elf_header = false;
|
||||
static bool display_program_headers = false;
|
||||
|
|
|
@ -14,7 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
const char* path;
|
||||
char const* path;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help(
|
||||
|
|
|
@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio cpath"));
|
||||
|
||||
Vector<const char*> paths;
|
||||
Vector<char const*> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(paths, "Directories to remove", "paths");
|
||||
|
|
|
@ -54,13 +54,13 @@ public:
|
|||
virtual ~TestRunner() = default;
|
||||
|
||||
protected:
|
||||
virtual void do_run_single_test(const String& test_path, size_t current_text_index, size_t num_tests) override;
|
||||
virtual void do_run_single_test(String const& test_path, size_t current_text_index, size_t num_tests) override;
|
||||
virtual Vector<String> get_test_paths() const override;
|
||||
virtual const Vector<String>* get_failed_test_names() const override { return &m_failed_test_names; }
|
||||
virtual Vector<String> const* get_failed_test_names() const override { return &m_failed_test_names; }
|
||||
|
||||
virtual FileResult run_test_file(const String& test_path);
|
||||
virtual FileResult run_test_file(String const& test_path);
|
||||
|
||||
bool should_skip_test(const LexicalPath& test_path);
|
||||
bool should_skip_test(LexicalPath const& test_path);
|
||||
|
||||
Regex<PosixExtended> m_exclude_regex;
|
||||
NonnullRefPtr<Core::ConfigFile> m_config;
|
||||
|
@ -75,7 +75,7 @@ protected:
|
|||
Vector<String> TestRunner::get_test_paths() const
|
||||
{
|
||||
Vector<String> paths;
|
||||
Test::iterate_directory_recursively(m_test_root, [&](const String& file_path) {
|
||||
Test::iterate_directory_recursively(m_test_root, [&](String const& file_path) {
|
||||
if (access(file_path.characters(), R_OK | X_OK) != 0)
|
||||
return;
|
||||
auto result = m_exclude_regex.match(file_path, PosixFlags::Global);
|
||||
|
@ -86,16 +86,16 @@ Vector<String> TestRunner::get_test_paths() const
|
|||
return paths;
|
||||
}
|
||||
|
||||
bool TestRunner::should_skip_test(const LexicalPath& test_path)
|
||||
bool TestRunner::should_skip_test(LexicalPath const& test_path)
|
||||
{
|
||||
if (m_run_skipped_tests)
|
||||
return false;
|
||||
|
||||
for (const String& dir : m_skip_directories) {
|
||||
for (String const& dir : m_skip_directories) {
|
||||
if (test_path.dirname().contains(dir))
|
||||
return true;
|
||||
}
|
||||
for (const String& file : m_skip_files) {
|
||||
for (String const& file : m_skip_files) {
|
||||
if (test_path.basename().contains(file))
|
||||
return true;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ bool TestRunner::should_skip_test(const LexicalPath& test_path)
|
|||
return false;
|
||||
}
|
||||
|
||||
void TestRunner::do_run_single_test(const String& test_path, size_t current_test_index, size_t num_tests)
|
||||
void TestRunner::do_run_single_test(String const& test_path, size_t current_test_index, size_t num_tests)
|
||||
{
|
||||
g_currently_running_test = test_path;
|
||||
auto test_relative_path = LexicalPath::relative_path(test_path, m_test_root);
|
||||
|
@ -225,7 +225,7 @@ void TestRunner::do_run_single_test(const String& test_path, size_t current_test
|
|||
close(test_result.stdout_err_fd);
|
||||
}
|
||||
|
||||
FileResult TestRunner::run_test_file(const String& test_path)
|
||||
FileResult TestRunner::run_test_file(String const& test_path)
|
||||
{
|
||||
double start_time = get_time_in_ms();
|
||||
|
||||
|
@ -248,7 +248,7 @@ FileResult TestRunner::run_test_file(const String& test_path)
|
|||
(void)posix_spawn_file_actions_adddup2(&file_actions, child_out_err_file, STDERR_FILENO);
|
||||
(void)posix_spawn_file_actions_addchdir(&file_actions, dirname.characters());
|
||||
|
||||
Vector<const char*, 4> argv;
|
||||
Vector<char const*, 4> argv;
|
||||
argv.append(basename.characters());
|
||||
auto extra_args = m_config->read_entry(path_for_test.basename(), "Arguments", "").split(' ');
|
||||
for (auto& arg : extra_args)
|
||||
|
@ -315,7 +315,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool print_all_output = false;
|
||||
bool run_benchmarks = false;
|
||||
bool run_skipped_tests = false;
|
||||
const char* specified_test_root = nullptr;
|
||||
char const* specified_test_root = nullptr;
|
||||
String test_glob;
|
||||
String exclude_pattern;
|
||||
String config_file;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
const char* const g_usage = R"(Usage:
|
||||
char const* const g_usage = R"(Usage:
|
||||
seq [-h|--help]
|
||||
seq LAST
|
||||
seq FIRST LAST
|
||||
|
@ -25,7 +25,7 @@ static void print_usage(FILE* stream)
|
|||
return;
|
||||
}
|
||||
|
||||
static double get_double(const char* name, const char* d_string, int* number_of_decimals)
|
||||
static double get_double(char const* name, char const* d_string, int* number_of_decimals)
|
||||
{
|
||||
char* end;
|
||||
double d = strtod(d_string, &end);
|
||||
|
@ -34,7 +34,7 @@ static double get_double(const char* name, const char* d_string, int* number_of_
|
|||
print_usage(stderr);
|
||||
exit(1);
|
||||
}
|
||||
if (const char* dot = strchr(d_string, '.'))
|
||||
if (char const* dot = strchr(d_string, '.'))
|
||||
*number_of_decimals = strlen(dot + 1);
|
||||
else
|
||||
*number_of_decimals = 0;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static volatile bool g_interrupted;
|
||||
static bool volatile g_interrupted;
|
||||
static void handle_sigint(int)
|
||||
{
|
||||
g_interrupted = true;
|
||||
|
|
|
@ -225,12 +225,12 @@ static void handle_sigint(int)
|
|||
}
|
||||
}
|
||||
|
||||
static ErrorOr<void> copy_from_process(const void* source, Bytes target)
|
||||
static ErrorOr<void> copy_from_process(void const* source, Bytes target)
|
||||
{
|
||||
return Core::System::ptrace_peekbuf(g_pid, const_cast<void*>(source), target);
|
||||
}
|
||||
|
||||
static ErrorOr<ByteBuffer> copy_from_process(const void* source, size_t length)
|
||||
static ErrorOr<ByteBuffer> copy_from_process(void const* source, size_t length)
|
||||
{
|
||||
auto buffer = TRY(ByteBuffer::create_uninitialized(length));
|
||||
TRY(copy_from_process(source, buffer.bytes()));
|
||||
|
@ -261,7 +261,7 @@ struct BitflagBase {
|
|||
|
||||
namespace AK {
|
||||
template<typename BitflagDerivative>
|
||||
requires(IsBaseOf<BitflagBase, BitflagDerivative>) && requires { BitflagDerivative::options; }
|
||||
requires(IsBaseOf<BitflagBase, BitflagDerivative>) && requires { BitflagDerivative::options; }
|
||||
struct Formatter<BitflagDerivative> : StandardFormatter {
|
||||
Formatter() = default;
|
||||
explicit Formatter(StandardFormatter formatter)
|
||||
|
@ -305,7 +305,7 @@ struct Formatter<BitflagDerivative> : StandardFormatter {
|
|||
}
|
||||
|
||||
struct PointerArgument {
|
||||
const void* value;
|
||||
void const* value;
|
||||
};
|
||||
|
||||
namespace AK {
|
||||
|
@ -809,11 +809,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio wpath cpath proc exec ptrace sigaction"));
|
||||
|
||||
Vector<const char*> child_argv;
|
||||
Vector<char const*> child_argv;
|
||||
|
||||
const char* output_filename = nullptr;
|
||||
const char* exclude_syscalls_option = nullptr;
|
||||
const char* include_syscalls_option = nullptr;
|
||||
char const* output_filename = nullptr;
|
||||
char const* exclude_syscalls_option = nullptr;
|
||||
char const* include_syscalls_option = nullptr;
|
||||
HashTable<StringView> exclude_syscalls;
|
||||
HashTable<StringView> include_syscalls;
|
||||
auto trace_file = Core::File::standard_error();
|
||||
|
@ -833,7 +833,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (output_filename != nullptr)
|
||||
trace_file = TRY(Core::File::open(output_filename, Core::OpenMode::WriteOnly));
|
||||
|
||||
auto parse_syscalls = [](const char* option, auto& hash_table) {
|
||||
auto parse_syscalls = [](char const* option, auto& hash_table) {
|
||||
if (option != nullptr) {
|
||||
for (auto syscall : StringView(option).split_view(','))
|
||||
hash_table.set(syscall);
|
||||
|
|
|
@ -156,8 +156,8 @@ constexpr ControlCharacter control_characters[] = {
|
|||
Optional<speed_t> numeric_value_to_speed(unsigned long);
|
||||
Optional<unsigned long> speed_to_numeric_value(speed_t);
|
||||
|
||||
void print_stty_readable(const termios&);
|
||||
void print_human_readable(const termios&, const winsize&, bool);
|
||||
void print_stty_readable(termios const&);
|
||||
void print_human_readable(termios const&, winsize const&, bool);
|
||||
Result<void, int> apply_stty_readable_modes(StringView, termios&);
|
||||
Result<void, int> apply_modes(size_t, char**, termios&, winsize&);
|
||||
|
||||
|
@ -179,7 +179,7 @@ Optional<unsigned long> speed_to_numeric_value(speed_t speed)
|
|||
return {};
|
||||
}
|
||||
|
||||
void print_stty_readable(const termios& modes)
|
||||
void print_stty_readable(termios const& modes)
|
||||
{
|
||||
out("{:x}:{:x}:{:x}:{:x}", modes.c_iflag, modes.c_oflag, modes.c_cflag, modes.c_lflag);
|
||||
for (size_t i = 0; i < NCCS; ++i)
|
||||
|
@ -187,7 +187,7 @@ void print_stty_readable(const termios& modes)
|
|||
out(":{:x}:{:x}\n", modes.c_ispeed, modes.c_ospeed);
|
||||
}
|
||||
|
||||
void print_human_readable(const termios& modes, const winsize& ws, bool verbose_mode)
|
||||
void print_human_readable(termios const& modes, winsize const& ws, bool verbose_mode)
|
||||
{
|
||||
auto print_speed = [&] {
|
||||
if (verbose_mode && modes.c_ispeed != modes.c_ospeed) {
|
||||
|
|
|
@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (!TRY(Core::System::isatty(STDIN_FILENO)))
|
||||
return Error::from_string_literal("Standard input is not a terminal");
|
||||
|
||||
const char* user = nullptr;
|
||||
char const* user = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(user, "User to switch to (defaults to user with UID 0)", "user", Core::ArgsParser::Required::No);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
FlatPtr arg[SC_NARG];
|
||||
char outbuf[BUFSIZ];
|
||||
|
||||
using Arguments = Vector<const char*>;
|
||||
using Arguments = Vector<char const*>;
|
||||
using ArgIter = Arguments::Iterator;
|
||||
|
||||
static FlatPtr parse_from(ArgIter&);
|
||||
|
@ -40,7 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
bool output_buffer = false;
|
||||
bool list_syscalls = false;
|
||||
Vector<const char*> syscall_arguments;
|
||||
Vector<char const*> syscall_arguments;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help(
|
||||
|
@ -154,7 +154,7 @@ static FlatPtr parse_parameter_buffer(ArgIter& iter)
|
|||
|
||||
static FlatPtr parse_from(ArgIter& iter)
|
||||
{
|
||||
const char* this_arg = *iter;
|
||||
char const* this_arg = *iter;
|
||||
++iter;
|
||||
|
||||
// Is it a forced literal?
|
||||
|
|
|
@ -19,7 +19,7 @@ static int tail_from_pos(Core::File& file, off_t startline, bool want_follow)
|
|||
return 1;
|
||||
|
||||
while (true) {
|
||||
const auto& b = file.read(4096);
|
||||
auto const& b = file.read(4096);
|
||||
if (b.is_empty()) {
|
||||
if (!want_follow) {
|
||||
break;
|
||||
|
@ -56,7 +56,7 @@ static off_t find_seek_pos(Core::File& file, int wanted_lines)
|
|||
// is smart enough to not read char-by-char. Fix it there, or fix it here :)
|
||||
for (; pos >= 0; pos--) {
|
||||
file.seek(pos);
|
||||
const auto& ch = file.read(1);
|
||||
auto const& ch = file.read(1);
|
||||
if (ch.is_empty()) {
|
||||
// Presumably the file got truncated?
|
||||
// Keep trying to read backwards...
|
||||
|
@ -78,7 +78,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
bool follow = false;
|
||||
int line_count = DEFAULT_LINE_COUNT;
|
||||
const char* file = nullptr;
|
||||
char const* file = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Print the end ('tail') of a file.");
|
||||
|
|
|
@ -32,8 +32,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool gzip = false;
|
||||
bool no_auto_compress = false;
|
||||
StringView archive_file;
|
||||
const char* directory = nullptr;
|
||||
Vector<const char*> paths;
|
||||
char const* directory = nullptr;
|
||||
Vector<char const*> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(create, "Create archive", "create", 'c');
|
||||
|
@ -96,7 +96,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
for (; !tar_stream.finished(); tar_stream.advance()) {
|
||||
const Archive::TarFileHeader& header = tar_stream.header();
|
||||
Archive::TarFileHeader const& header = tar_stream.header();
|
||||
|
||||
// Handle meta-entries earlier to avoid consuming the file content stream.
|
||||
if (header.content_is_like_extended_header()) {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
T(URL)
|
||||
|
||||
#undef __ENUMERATE_TARGET
|
||||
#define __ENUMERATE_TARGET(x) extern "C" int Test##x(const uint8_t*, size_t);
|
||||
#define __ENUMERATE_TARGET(x) extern "C" int Test##x(uint8_t const*, size_t);
|
||||
ENUMERATE_TARGETS(__ENUMERATE_TARGET)
|
||||
#undef __ENUMERATE_TARGET
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
bool g_there_was_an_error = false;
|
||||
|
||||
[[noreturn, gnu::format(printf, 1, 2)]] static void fatal_error(const char* format, ...)
|
||||
[[noreturn, gnu::format(printf, 1, 2)]] static void fatal_error(char const* format, ...)
|
||||
{
|
||||
fputs("\033[31m", stderr);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static void assert_env(const char* name, const char* value)
|
||||
static void assert_env(char const* name, char const* value)
|
||||
{
|
||||
char* result = getenv(name);
|
||||
if (!result) {
|
||||
|
|
|
@ -68,7 +68,7 @@ struct ThreadData {
|
|||
};
|
||||
|
||||
struct PidAndTid {
|
||||
bool operator==(const PidAndTid& other) const
|
||||
bool operator==(PidAndTid const& other) const
|
||||
{
|
||||
return pid == other.pid && tid == other.tid;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ struct PidAndTid {
|
|||
namespace AK {
|
||||
template<>
|
||||
struct Traits<PidAndTid> : public GenericTraits<PidAndTid> {
|
||||
static unsigned hash(const PidAndTid& value) { return pair_int_hash(value.pid, value.tid); }
|
||||
static unsigned hash(PidAndTid const& value) { return pair_int_hash(value.pid, value.tid); }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ static void parse_args(Main::Arguments arguments, TopOption& top_option)
|
|||
"sort-by",
|
||||
's',
|
||||
nullptr,
|
||||
[&top_option](const char* s) {
|
||||
[&top_option](char const* s) {
|
||||
StringView sort_by_option { s };
|
||||
if (sort_by_option == "pid"sv)
|
||||
top_option.sort_by = TopOption::SortBy::Pid;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
|
||||
static bool file_exists(const char* path)
|
||||
static bool file_exists(char const* path)
|
||||
{
|
||||
struct stat st;
|
||||
int rc = stat(path, &st);
|
||||
|
@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath cpath fattr"));
|
||||
|
||||
Vector<const char*> paths;
|
||||
Vector<char const*> paths;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help("Create a file, or update its mtime (time of last modification).");
|
||||
|
|
|
@ -96,8 +96,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool complement_flag = false;
|
||||
bool delete_flag = false;
|
||||
bool squeeze_flag = false;
|
||||
const char* from_chars = nullptr;
|
||||
const char* to_chars = nullptr;
|
||||
char const* from_chars = nullptr;
|
||||
char const* to_chars = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(complement_flag, "Take the complement of the first set", "complement", 'c');
|
||||
|
|
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio id inet unix"));
|
||||
|
||||
const char* host_name;
|
||||
char const* host_name;
|
||||
int max_hops = 30;
|
||||
int max_retries = 3;
|
||||
int echo_timeout = 5;
|
||||
|
@ -53,7 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
sockaddr_in host_address {};
|
||||
host_address.sin_family = AF_INET;
|
||||
host_address.sin_port = 44444;
|
||||
host_address.sin_addr.s_addr = *(const in_addr_t*)hostent->h_addr_list[0];
|
||||
host_address.sin_addr.s_addr = *(in_addr_t const*)hostent->h_addr_list[0];
|
||||
|
||||
int fd = TRY(Core::System::socket(AF_INET, SOCK_RAW, IPPROTO_ICMP));
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static int max_depth = INT_MAX;
|
|||
static int g_directories_seen = 0;
|
||||
static int g_files_seen = 0;
|
||||
|
||||
static void print_directory_tree(const String& root_path, int depth, const String& indent_string)
|
||||
static void print_directory_tree(String const& root_path, int depth, String const& indent_string)
|
||||
{
|
||||
if (depth > 0) {
|
||||
String root_indent_string;
|
||||
|
@ -106,7 +106,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath tty"));
|
||||
|
||||
Vector<const char*> directories;
|
||||
Vector<char const*> directories;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(flag_show_hidden_files, "Show hidden files", "all", 'a');
|
||||
|
@ -124,7 +124,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
print_directory_tree(".", 0, "");
|
||||
puts("");
|
||||
} else {
|
||||
for (const char* directory : directories) {
|
||||
for (char const* directory : directories) {
|
||||
print_directory_tree(directory, 0, "");
|
||||
puts("");
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath wpath cpath"));
|
||||
|
||||
const char* resize = nullptr;
|
||||
const char* reference = nullptr;
|
||||
const char* file = nullptr;
|
||||
char const* resize = nullptr;
|
||||
char const* reference = nullptr;
|
||||
char const* file = nullptr;
|
||||
|
||||
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");
|
||||
|
|
|
@ -24,7 +24,7 @@ static int kill_test();
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
const char* test_name = "n";
|
||||
char const* test_name = "n";
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.set_general_help(
|
||||
|
|
|
@ -18,7 +18,7 @@ struct linebuf {
|
|||
size_t len = 0;
|
||||
};
|
||||
|
||||
static FILE* get_stream(const char* filepath, const char* perms)
|
||||
static FILE* get_stream(char const* filepath, char const* perms)
|
||||
{
|
||||
FILE* ret;
|
||||
|
||||
|
@ -41,8 +41,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath wpath cpath"));
|
||||
|
||||
const char* inpath = nullptr;
|
||||
const char* outpath = nullptr;
|
||||
char const* inpath = nullptr;
|
||||
char const* outpath = nullptr;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(inpath, "Input file", "input", Core::ArgsParser::Required::No);
|
||||
args_parser.add_positional_argument(outpath, "Output file", "output", Core::ArgsParser::Required::No);
|
||||
|
|
|
@ -75,7 +75,7 @@ static bool unpack_zip_member(Archive::ZipMember zip_member, bool quiet)
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
const char* path;
|
||||
char const* path;
|
||||
int map_size_limit = 32 * MiB;
|
||||
bool quiet { false };
|
||||
String output_directory_path;
|
||||
|
|
|
@ -25,20 +25,20 @@
|
|||
|
||||
constexpr uid_t BASE_UID = 1000;
|
||||
constexpr gid_t USERS_GID = 100;
|
||||
constexpr const char* DEFAULT_SHELL = "/bin/sh";
|
||||
constexpr char const* DEFAULT_SHELL = "/bin/sh";
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio wpath rpath cpath chown"));
|
||||
|
||||
const char* home_path = nullptr;
|
||||
char const* home_path = nullptr;
|
||||
int uid = 0;
|
||||
int gid = USERS_GID;
|
||||
bool create_home_dir = false;
|
||||
const char* password = "";
|
||||
const char* shell = DEFAULT_SHELL;
|
||||
const char* gecos = "";
|
||||
const char* username = nullptr;
|
||||
char const* password = "";
|
||||
char const* shell = DEFAULT_SHELL;
|
||||
char const* gecos = "";
|
||||
char const* username = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(home_path, "Home directory for the new user", "home-dir", 'd', "path");
|
||||
|
|
|
@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/etc/", "rwc"));
|
||||
TRY(Core::System::unveil("/bin/rm", "x"));
|
||||
|
||||
const char* username = nullptr;
|
||||
char const* username = nullptr;
|
||||
bool remove_home = false;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
|
@ -161,7 +161,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
|
||||
pid_t child;
|
||||
const char* argv[] = { "rm", "-r", target_account.home_directory().characters(), nullptr };
|
||||
char const* argv[] = { "rm", "-r", target_account.home_directory().characters(), nullptr };
|
||||
if ((errno = posix_spawn(&child, "/bin/rm", nullptr, nullptr, const_cast<char**>(argv), environ))) {
|
||||
perror("posix_spawn");
|
||||
return 12;
|
||||
|
|
|
@ -30,11 +30,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
int gid = 0;
|
||||
bool lock = false;
|
||||
bool unlock = false;
|
||||
const char* new_home_directory = nullptr;
|
||||
char const* new_home_directory = nullptr;
|
||||
bool move_home = false;
|
||||
const char* shell = nullptr;
|
||||
const char* gecos = nullptr;
|
||||
const char* username = nullptr;
|
||||
char const* shell = nullptr;
|
||||
char const* gecos = nullptr;
|
||||
char const* username = nullptr;
|
||||
|
||||
auto args_parser = Core::ArgsParser();
|
||||
args_parser.set_general_help("Modify a user account");
|
||||
|
|
|
@ -24,8 +24,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
pid_t pid = 0;
|
||||
bool flag_create = false;
|
||||
bool flag_delete = false;
|
||||
const char* tty_name = nullptr;
|
||||
const char* from = nullptr;
|
||||
char const* tty_name = nullptr;
|
||||
char const* from = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(flag_create, "Create entry", "create", 'c');
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
static int opt_interval = 2;
|
||||
static bool flag_noheader = false;
|
||||
static bool flag_beep_on_fail = false;
|
||||
static volatile int exit_code = 0;
|
||||
static int volatile exit_code = 0;
|
||||
static volatile pid_t child_pid = -1;
|
||||
|
||||
static String build_header_string(Vector<char const*> const& command, struct timeval const& interval)
|
||||
|
|
|
@ -27,7 +27,7 @@ bool g_output_line = false;
|
|||
bool g_output_byte = false;
|
||||
bool g_output_word = false;
|
||||
|
||||
static void wc_out(const Count& count)
|
||||
static void wc_out(Count const& count)
|
||||
{
|
||||
if (g_output_line)
|
||||
out("{:7} ", count.lines);
|
||||
|
@ -39,7 +39,7 @@ static void wc_out(const Count& count)
|
|||
outln("{:>14}", count.name);
|
||||
}
|
||||
|
||||
static Count get_count(const String& file_specifier)
|
||||
static Count get_count(String const& file_specifier)
|
||||
{
|
||||
Count count;
|
||||
FILE* file_pointer = nullptr;
|
||||
|
@ -74,7 +74,7 @@ static Count get_count(const String& file_specifier)
|
|||
return count;
|
||||
}
|
||||
|
||||
static Count get_total_count(const Vector<Count>& counts)
|
||||
static Count get_total_count(Vector<Count> const& counts)
|
||||
{
|
||||
Count total_count { "total" };
|
||||
for (auto& count : counts) {
|
||||
|
@ -90,7 +90,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
Vector<const char*> file_specifiers;
|
||||
Vector<char const*> file_specifiers;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(g_output_line, "Output line count", "lines", 'l');
|
||||
|
@ -103,7 +103,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
g_output_line = g_output_byte = g_output_word = true;
|
||||
|
||||
Vector<Count> counts;
|
||||
for (const auto& file_specifier : file_specifiers)
|
||||
for (auto const& file_specifier : file_specifiers)
|
||||
counts.append(get_count(file_specifier));
|
||||
|
||||
TRY(Core::System::pledge("stdio"));
|
||||
|
@ -113,7 +113,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
else if (file_specifiers.size() > 1)
|
||||
counts.append(get_total_count(counts));
|
||||
|
||||
for (const auto& count : counts) {
|
||||
for (auto const& count : counts) {
|
||||
if (count.exists)
|
||||
wc_out(count);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
const char* filename = nullptr;
|
||||
char const* filename = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(filename, "Name of executable", "executable");
|
||||
|
|
|
@ -28,9 +28,9 @@ bool read_items(FILE* fp, char entry_separator, Function<Decision(StringView)>);
|
|||
|
||||
class ParsedInitialArguments {
|
||||
public:
|
||||
ParsedInitialArguments(Vector<const char*>&, StringView placeholder);
|
||||
ParsedInitialArguments(Vector<char const*>&, StringView placeholder);
|
||||
|
||||
void for_each_joined_argument(StringView, Function<void(const String&)>) const;
|
||||
void for_each_joined_argument(StringView, Function<void(String const&)>) const;
|
||||
|
||||
size_t size() const { return m_all_parts.size(); }
|
||||
|
||||
|
@ -42,12 +42,12 @@ ErrorOr<int> serenity_main(Main::Arguments main_arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio rpath proc exec", nullptr));
|
||||
|
||||
const char* placeholder = nullptr;
|
||||
char const* placeholder = nullptr;
|
||||
bool split_with_nulls = false;
|
||||
const char* specified_delimiter = "\n";
|
||||
Vector<const char*> arguments;
|
||||
char const* specified_delimiter = "\n";
|
||||
Vector<char const*> arguments;
|
||||
bool verbose = false;
|
||||
const char* file_to_read = "-";
|
||||
char const* file_to_read = "-";
|
||||
int max_lines_for_one_command = 0;
|
||||
int max_bytes_for_one_command = ARG_MAX;
|
||||
|
||||
|
@ -238,7 +238,7 @@ bool run_command(Vector<char*>&& child_argv, bool verbose, bool is_stdin, int de
|
|||
return true;
|
||||
}
|
||||
|
||||
ParsedInitialArguments::ParsedInitialArguments(Vector<const char*>& arguments, StringView placeholder)
|
||||
ParsedInitialArguments::ParsedInitialArguments(Vector<char const*>& arguments, StringView placeholder)
|
||||
{
|
||||
m_all_parts.ensure_capacity(arguments.size());
|
||||
bool some_argument_has_placeholder = false;
|
||||
|
@ -264,7 +264,7 @@ ParsedInitialArguments::ParsedInitialArguments(Vector<const char*>& arguments, S
|
|||
}
|
||||
}
|
||||
|
||||
void ParsedInitialArguments::for_each_joined_argument(StringView separator, Function<void(const String&)> callback) const
|
||||
void ParsedInitialArguments::for_each_joined_argument(StringView separator, Function<void(String const&)> callback) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
for (auto& parts : m_all_parts) {
|
||||
|
|
|
@ -13,7 +13,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
{
|
||||
TRY(Core::System::pledge("stdio"));
|
||||
|
||||
const char* string = "yes";
|
||||
char const* string = "yes";
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_positional_argument(string, "String to output (defaults to 'yes')", "string", Core::ArgsParser::Required::No);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
const char* zip_path;
|
||||
char const* zip_path;
|
||||
Vector<StringView> source_paths;
|
||||
bool recurse = false;
|
||||
bool force = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue