strings: Add -o
option as an alias for -t o
This commit is contained in:
parent
a2fb0768ff
commit
c723101728
Notes:
sideshowbarker
2024-07-17 09:47:09 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/c723101728 Pull-request: https://github.com/SerenityOS/serenity/pull/19515
2 changed files with 11 additions and 1 deletions
|
@ -5,7 +5,7 @@ strings - find printable strings in files
|
|||
## Synopsis
|
||||
|
||||
```**sh
|
||||
$ strings [--bytes NUMBER] [--print-file-name] [--radix FORMAT] [PATHS...]
|
||||
$ strings [--bytes NUMBER] [--print-file-name] [-o] [--radix FORMAT] [PATHS...]
|
||||
```
|
||||
|
||||
## Description
|
||||
|
@ -16,6 +16,7 @@ $ strings [--bytes NUMBER] [--print-file-name] [--radix FORMAT] [PATHS...]
|
|||
|
||||
* `-n NUMBER`, `--bytes NUMBER`: Specify the minimum string length (4 is default).
|
||||
* `-f`, `--print-file-name`: Print the name of the file before each string.
|
||||
* `-o`: Equivalent to specifying `-t o`.
|
||||
* `-t FORMAT`, `--radix FORMAT`: Write each string preceded by its byte offset from the start of the file in the specified `FORMAT`, where `FORMAT` matches one of the following: `d` (decimal), `o` (octal), or `x` (hexidecimal).
|
||||
|
||||
## Examples
|
||||
|
|
|
@ -118,6 +118,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
return true;
|
||||
} });
|
||||
args_parser.add_option({ Core::ArgsParser::OptionArgumentMode::None,
|
||||
"Equivalent to specifying -t o.",
|
||||
nullptr,
|
||||
'o',
|
||||
nullptr,
|
||||
[&string_offset_format](auto) {
|
||||
string_offset_format = StringOffsetFormat::Octal;
|
||||
return true;
|
||||
} });
|
||||
args_parser.set_general_help("Write the sequences of printable characters in files or pipes to stdout.");
|
||||
args_parser.add_positional_argument(paths, "File path", "path", Core::ArgsParser::Required::No);
|
||||
args_parser.parse(arguments);
|
||||
|
|
Loading…
Add table
Reference in a new issue