diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-01-21 20:27:37 +0100 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2021-04-14 17:21:43 +0200 |
commit | 36880cd61c52f13c6fd284aa23d42d9493d3ab2e (patch) | |
tree | 54df8a9e8ef536db034af9a3f1d6496626ad802b /CommandLine.c | |
parent | 812cfcb94df0fc0e6f9d33e39078454842d61609 (diff) |
Add read-only option
Add command line option to disable all system and process changing
features.
Diffstat (limited to 'CommandLine.c')
-rw-r--r-- | CommandLine.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/CommandLine.c b/CommandLine.c index 796018af..16ded1fa 100644 --- a/CommandLine.c +++ b/CommandLine.c @@ -53,6 +53,7 @@ static void printHelpFlag(const char* name) { "-H --highlight-changes[=DELAY] Highlight new and old processes\n" "-M --no-mouse Disable the mouse\n" "-p --pid=PID[,PID,PID...] Show only the given PIDs\n" + " --readonly Disable all system and process changing features\n" "-s --sort-key=COLUMN Sort by COLUMN in list view (try --sort-key=help for a list)\n" "-t --tree Show the tree view (can be combined with -s)\n" "-u --user[=USERNAME] Show only processes for a given user (or $USER)\n" @@ -79,6 +80,7 @@ typedef struct CommandLineSettings_ { bool allowUnicode; bool highlightChanges; int highlightDelaySecs; + bool readonly; } CommandLineSettings; static CommandLineSettings parseArguments(const char* program, int argc, char** argv) { @@ -95,6 +97,7 @@ static CommandLineSettings parseArguments(const char* program, int argc, char** .allowUnicode = true, .highlightChanges = false, .highlightDelaySecs = -1, + .readonly = false, }; const struct option long_opts[] = @@ -112,6 +115,7 @@ static CommandLineSettings parseArguments(const char* program, int argc, char** {"pid", required_argument, 0, 'p'}, {"filter", required_argument, 0, 'F'}, {"highlight-changes", optional_argument, 0, 'H'}, + {"readonly", no_argument, 0, 128}, PLATFORM_LONG_OPTIONS {0,0,0,0} }; @@ -231,6 +235,9 @@ static CommandLineSettings parseArguments(const char* program, int argc, char** flags.highlightChanges = true; break; } + case 128: + flags.readonly = true; + break; default: if (Platform_getLongOption(opt, argc, argv) == false) @@ -273,6 +280,9 @@ int CommandLine_run(const char* name, int argc, char** argv) { CommandLineSettings flags = parseArguments(name, argc, argv); + if (flags.readonly) + Settings_enableReadonly(); + Platform_init(); Process_setupColumnWidths(); |