mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-30 14:43:38 +03:00
5e1499d104
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2020, Peter Elliott <pelliott@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibCore/ArgsParser.h>
|
|
#include <LibCore/FilePermissionsMask.h>
|
|
#include <LibCore/System.h>
|
|
#include <LibMain/Main.h>
|
|
#include <sys/stat.h>
|
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
{
|
|
TRY(Core::System::pledge("stdio dpath"));
|
|
|
|
ByteString mode_string;
|
|
mode_t mask_reference_mode = 0777;
|
|
mode_t mode = 0666;
|
|
Vector<StringView> paths;
|
|
|
|
Core::ArgsParser args_parser;
|
|
args_parser.add_option(mode_string, "Set FIFO permissions", "mode", 'm', "mode");
|
|
args_parser.add_positional_argument(paths, "Paths of FIFOs to create", "paths");
|
|
args_parser.parse(arguments);
|
|
|
|
if (!mode_string.is_empty()) {
|
|
auto mask = TRY(Core::FilePermissionsMask::parse(mode_string));
|
|
mode = mask.apply(mask_reference_mode);
|
|
}
|
|
|
|
int exit_code = 0;
|
|
for (auto path : paths) {
|
|
auto error_or_void = Core::System::mkfifo(path, mode);
|
|
if (error_or_void.is_error()) {
|
|
warnln("mkfifo: Couldn't create fifo '{}': {}", path, error_or_void.error());
|
|
exit_code = 1;
|
|
}
|
|
}
|
|
|
|
return exit_code;
|
|
}
|