summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-23 07:22:07 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-27 13:28:07 +0300
commita8aaf568578332d669aa7892c689bbff16f21c6f (patch)
tree6f330383a2109eca2a02e5fe2d9ad437118ab048 /src
parent28990d36fea96f729231dfb6c978b7606b0f74cc (diff)
cam: options: Restore std::cerr adjustment field
The std::cerr adjustment is set to std::left to print the usage text. Restore it to its original value when done, to avoid affecting the caller. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/cam/options.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cam/options.cpp b/src/cam/options.cpp
index 33bc512e..4f7e8691 100644
--- a/src/cam/options.cpp
+++ b/src/cam/options.cpp
@@ -453,7 +453,7 @@ void KeyValueParser::usage(int indent)
argument += "]";
}
- std::cerr << std::setw(indent) << std::left << argument;
+ std::cerr << std::setw(indent) << argument;
for (const char *help = option.help, *end = help; end;) {
end = strchr(help, '\n');
@@ -994,7 +994,12 @@ void OptionsParser::usage()
std::cerr << "Options:" << std::endl;
+ std::ios_base::fmtflags f(std::cerr.flags());
+ std::cerr << std::left;
+
usageOptions(options_, indent);
+
+ std::cerr.flags(f);
}
void OptionsParser::usageOptions(const std::list<Option> &options,
@@ -1031,7 +1036,7 @@ void OptionsParser::usageOptions(const std::list<Option> &options,
if (option.isArray)
argument += " ...";
- std::cerr << std::setw(indent) << std::left << argument;
+ std::cerr << std::setw(indent) << argument;
for (const char *help = option.help, *end = help; end; ) {
end = strchr(help, '\n');