aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2019-12-04 00:02:42 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2019-12-04 00:02:42 +0100
commit3b994f54899e526fa9e86121ce9efb6ca299d629 (patch)
treec2b69c1cdec49b081e3c2b390ec3366e8e9c8661 /src/main.cpp
parentBetter include (diff)
downloadlowbat-gnu-3b994f54899e526fa9e86121ce9efb6ca299d629.tar.gz
lowbat-gnu-3b994f54899e526fa9e86121ce9efb6ca299d629.tar.bz2
lowbat-gnu-3b994f54899e526fa9e86121ce9efb6ca299d629.tar.xz
lowbat-gnu-3b994f54899e526fa9e86121ce9efb6ca299d629.tar.zst
lowbat-gnu-3b994f54899e526fa9e86121ce9efb6ca299d629.zip
.gitignore C++ update, doing some debug
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 2fe6063..ed05f71 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4,19 +4,19 @@ int main(int argc, const char *argv[]) {
string msg = nullptr;
string acstat = nullptr;
string batlvl = nullptr;
- stringstream battoint = nullptr;
int batlvlint = 0;
- if (memcmp(argv[1], "--say", strlen(argv[1])))
- msg = "beep beep - low battery";
- else
- msg = argv[2];
+ if (argc > 1) {
+ if (memcmp(argv[1], "--say", strlen(argv[1])))
+ msg = "beep beep - low battery";
+ else
+ msg = argv[2];
+ }
while (true) {
acstat = jo_exec("acpi | awk '{print $3}' | rev | cut -c 2- | rev");
batlvl = jo_exec("acpi | awk '{print $4}' | rev | cut -c 3- | rev");
- battoint = batlvl;
- battoint >> batlvlint;
+ batlvlint = stoi(batlvl);
if (batlvlint < 15) {
while (!memcmp(acstat, "Discharging", strlen(acstat))) {
jo_notify(batlvl);