1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

Userland: Convert command line arguments to String/StringView

StringView was used where possible. Some utilities still use libc
functions which expect null-terminated strings, so String objects were
used there instead.
This commit is contained in:
sin-ack 2022-07-11 20:42:03 +00:00 committed by Andreas Kling
parent fded8f861d
commit 60f6bc902b
25 changed files with 101 additions and 100 deletions

View file

@ -526,8 +526,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
{
TRY(Core::System::pledge("stdio rpath tty sigaction"));
char const* filename = "-";
char const* prompt = "?f%f :.(line %l)?e (END):.";
// FIXME: Make these into StringViews once we stop using fopen below.
String filename = "-";
String prompt = "?f%f :.(line %l)?e (END):.";
bool dont_switch_buffer = false;
bool quit_at_eof = false;
bool emulate_more = false;
@ -546,7 +547,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
FILE* file;
if (String("-") == filename) {
file = stdin;
} else if ((file = fopen(filename, "r")) == nullptr) {
} else if ((file = fopen(filename.characters(), "r")) == nullptr) {
perror("fopen");
exit(1);
}