mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
grep: Recognize mode based on the program name
This commit is contained in:
parent
0865a06ef5
commit
4a5d1db7f6
1 changed files with 5 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/ScopeGuard.h>
|
#include <AK/ScopeGuard.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
@ -36,10 +37,12 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
||||||
{
|
{
|
||||||
TRY(Core::System::pledge("stdio rpath", nullptr));
|
TRY(Core::System::pledge("stdio rpath", nullptr));
|
||||||
|
|
||||||
|
String program_name = AK::LexicalPath::basename(args.strings[0]);
|
||||||
|
|
||||||
Vector<const char*> files;
|
Vector<const char*> files;
|
||||||
|
|
||||||
bool recursive { false };
|
bool recursive = (program_name == "rgrep"sv);
|
||||||
bool use_ere { false };
|
bool use_ere = (program_name == "egrep"sv);
|
||||||
Vector<const char*> patterns;
|
Vector<const char*> patterns;
|
||||||
BinaryFileMode binary_mode { BinaryFileMode::Binary };
|
BinaryFileMode binary_mode { BinaryFileMode::Binary };
|
||||||
bool case_insensitive = false;
|
bool case_insensitive = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue