summaryrefslogtreecommitdiff
path: root/src/libctor.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2025-04-03 07:56:04 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2025-04-03 08:17:16 +0200
commitcd6c3ea1c3ca853fc38da4fa5fd62545c31aa92d (patch)
tree57d7956ab19a756cfcf8fdd65aa8fb6e511133c5 /src/libctor.cc
parent494401c0e0d29018f0ac53e91a3481d12e427ea6 (diff)
Refactor getenv usage.stuffdevelop
Diffstat (limited to 'src/libctor.cc')
-rw-r--r--src/libctor.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libctor.cc b/src/libctor.cc
index d72d82b..2685ec0 100644
--- a/src/libctor.cc
+++ b/src/libctor.cc
@@ -17,7 +17,6 @@
#include <cstdlib>
#include <span>
-
#include "ctor.h"
#include "configure.h"
#include "rebuild.h"
@@ -25,6 +24,7 @@
#include "build.h"
#include "unittest.h"
#include "argparser.h"
+#include "util.h"
int main(int argc, char* argv[])
{
@@ -221,10 +221,16 @@ Options:
return res;
}
- auto verbose_env = std::getenv("V");
- if(verbose_env)
+ if(std::string value; get_env("V", value))
{
- settings.verbose = std::atoi(verbose_env);
+ try
+ {
+ settings.verbose = std::stoi(value);
+ }
+ catch(...)
+ {
+ // not an integer
+ }
}
if(list_files)