mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 17:17:45 +00:00
Everywhere: "file name" => "filename"
This commit is contained in:
parent
def1f1444a
commit
7ae7170d61
59 changed files with 181 additions and 181 deletions
|
@ -30,8 +30,8 @@ int main(int argc, char** argv)
|
|||
args_parser.set_general_help("Print the beginning ('head') of a file.");
|
||||
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_option(never_print_filenames, "Never print filenames", "quiet", 'q');
|
||||
args_parser.add_option(always_print_filenames, "Always print filenames", "verbose", 'v');
|
||||
args_parser.add_positional_argument(files, "File to process", "file", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
|
|
|
@ -574,8 +574,8 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::repl_help)
|
|||
outln("REPL commands:");
|
||||
outln(" exit(code): exit the REPL with specified code. Defaults to 0.");
|
||||
outln(" help(): display this menu");
|
||||
outln(" load(files): accepts file names as params to load into running session. For example load(\"js/1.js\", \"js/2.js\", \"js/3.js\")");
|
||||
outln(" save(file): accepts a file name, writes REPL input history to a file. For example: save(\"foo.txt\")");
|
||||
outln(" load(files): accepts filenames as params to load into running session. For example load(\"js/1.js\", \"js/2.js\", \"js/3.js\")");
|
||||
outln(" save(file): accepts a filename, writes REPL input history to a file. For example: save(\"foo.txt\")");
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
|
@ -585,10 +585,10 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::load_file)
|
|||
return JS::Value(false);
|
||||
|
||||
for (auto& file : vm.call_frame().arguments) {
|
||||
String file_name = file.as_string().string();
|
||||
auto js_file = Core::File::construct(file_name);
|
||||
String filename = file.as_string().string();
|
||||
auto js_file = Core::File::construct(filename);
|
||||
if (!js_file->open(Core::IODevice::ReadOnly)) {
|
||||
warnln("Failed to open {}: {}", file_name, js_file->error_string());
|
||||
warnln("Failed to open {}: {}", filename, js_file->error_string());
|
||||
continue;
|
||||
}
|
||||
auto file_contents = js_file->read_all();
|
||||
|
|
|
@ -124,7 +124,7 @@ int main(int argc, char* argv[])
|
|||
int arg_uid_int = -1;
|
||||
int arg_pgid { -1 };
|
||||
pid_t arg_pid { -1 };
|
||||
const char* arg_file_name { nullptr };
|
||||
const char* arg_filename { nullptr };
|
||||
|
||||
if (argc == 1)
|
||||
arg_all_processes = true;
|
||||
|
@ -135,7 +135,7 @@ int main(int argc, char* argv[])
|
|||
parser.add_option(arg_fd, "Select by file descriptor", nullptr, 'd', "fd");
|
||||
parser.add_option(arg_uid, "Select by login/UID", nullptr, 'u', "login/UID");
|
||||
parser.add_option(arg_pgid, "Select by process group ID", nullptr, 'g', "PGID");
|
||||
parser.add_positional_argument(arg_file_name, "File name", "file name", Core::ArgsParser::Required::No);
|
||||
parser.add_positional_argument(arg_filename, "Filename", "filename", Core::ArgsParser::Required::No);
|
||||
parser.parse(argc, argv);
|
||||
}
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ int main(int argc, char* argv[])
|
|||
|| (arg_uid_int != -1 && (int)process.value.uid == arg_uid_int)
|
||||
|| (arg_uid != nullptr && process.value.username == arg_uid)
|
||||
|| (arg_pgid != -1 && (int)process.value.pgid == arg_pgid)
|
||||
|| (arg_file_name != nullptr && file.name == arg_file_name))
|
||||
|| (arg_filename != nullptr && file.name == arg_filename))
|
||||
display_entry(file, process.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
const char* file_name = nullptr;
|
||||
const char* filename = nullptr;
|
||||
bool html = false;
|
||||
int view_width = 0;
|
||||
|
||||
|
@ -30,7 +30,7 @@ int main(int argc, char* argv[])
|
|||
args_parser.set_general_help("Render Markdown to some other format.");
|
||||
args_parser.add_option(html, "Render to HTML rather than for the terminal", "html", 'H');
|
||||
args_parser.add_option(view_width, "Viewport width for the terminal (defaults to current terminal width)", "view-width", 0, "width");
|
||||
args_parser.add_positional_argument(file_name, "Path to Markdown file", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.add_positional_argument(filename, "Path to Markdown file", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
if (!html && view_width == 0) {
|
||||
|
@ -47,10 +47,10 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
auto file = Core::File::construct();
|
||||
bool success;
|
||||
if (file_name == nullptr) {
|
||||
if (filename == nullptr) {
|
||||
success = file->open(STDIN_FILENO, Core::IODevice::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::No);
|
||||
} else {
|
||||
file->set_filename(file_name);
|
||||
file->set_filename(filename);
|
||||
success = file->open(Core::IODevice::OpenMode::ReadOnly);
|
||||
}
|
||||
if (!success) {
|
||||
|
|
|
@ -42,17 +42,17 @@ int main(int argc, char** argv)
|
|||
unsigned long name_max = flag_most_posix ? _POSIX_NAME_MAX : pathconf(str_path.characters(), _PC_NAME_MAX);
|
||||
|
||||
if (str_path.length() > path_max) {
|
||||
warnln("{}: limit {} exceeded by length {} of file name '{}'", argv[0], path_max, str_path.length(), str_path);
|
||||
warnln("{}: limit {} exceeded by length {} of filename '{}'", argv[0], path_max, str_path.length(), str_path);
|
||||
fail = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (flag_most_posix) {
|
||||
// POSIX portable file name character set (a-z A-Z 0-9 . _ -)
|
||||
// POSIX portable filename character set (a-z A-Z 0-9 . _ -)
|
||||
for (long unsigned i = 0; i < str_path.length(); ++i) {
|
||||
auto c = path[i];
|
||||
if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && c != '/' && c != '.' && c != '-' && c != '_') {
|
||||
warnln("{}: non-portable character '{}' in file name '{}'", argv[0], path[i], str_path);
|
||||
warnln("{}: non-portable character '{}' in filename '{}'", argv[0], path[i], str_path);
|
||||
fail = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ int main(int argc, char** argv)
|
|||
|
||||
if (flag_empty_name_and_leading_dash) {
|
||||
if (str_path.is_empty()) {
|
||||
warnln("{}: empty file name", argv[0]);
|
||||
warnln("{}: empty filename", argv[0]);
|
||||
fail = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -79,13 +79,13 @@ int main(int argc, char** argv)
|
|||
for (auto& component : str_path.split('/')) {
|
||||
if (flag_empty_name_and_leading_dash) {
|
||||
if (component.starts_with('-')) {
|
||||
warnln("{}: leading '-' in a component of file name '{}'", argv[0], str_path);
|
||||
warnln("{}: leading '-' in a component of filename '{}'", argv[0], str_path);
|
||||
fail = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (component.length() > name_max) {
|
||||
warnln("{}: limit {} exceeded by length {} of file name component '{}'", argv[0], name_max, component.length(), component.characters());
|
||||
warnln("{}: limit {} exceeded by length {} of filename component '{}'", argv[0], name_max, component.length(), component.characters());
|
||||
fail = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
for (; !tar_stream.finished(); tar_stream.advance()) {
|
||||
if (list || verbose)
|
||||
outln("{}", tar_stream.header().file_name());
|
||||
outln("{}", tar_stream.header().filename());
|
||||
|
||||
if (extract) {
|
||||
Archive::TarFileStream file_stream = tar_stream.file_contents();
|
||||
|
@ -77,7 +77,7 @@ int main(int argc, char** argv)
|
|||
switch (header.type_flag()) {
|
||||
case Archive::TarFileType::NormalFile:
|
||||
case Archive::TarFileType::AlternateNormalFile: {
|
||||
int fd = open(String(header.file_name()).characters(), O_CREAT | O_WRONLY, header.mode());
|
||||
int fd = open(String(header.filename()).characters(), O_CREAT | O_WRONLY, header.mode());
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
return 1;
|
||||
|
@ -95,7 +95,7 @@ int main(int argc, char** argv)
|
|||
break;
|
||||
}
|
||||
case Archive::TarFileType::Directory: {
|
||||
if (mkdir(String(header.file_name()).characters(), header.mode())) {
|
||||
if (mkdir(String(header.filename()).characters(), header.mode())) {
|
||||
perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ static int run(Function<void(const char*, size_t)> fn)
|
|||
}
|
||||
} else {
|
||||
if (filename == nullptr) {
|
||||
puts("must specify a file name");
|
||||
puts("must specify a filename");
|
||||
return 1;
|
||||
}
|
||||
if (!Core::File::exists(filename)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue