aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-16 19:18:20 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-16 19:18:20 +0200
commit754010fba962a7fe859e7f2efb977ec4eff04920 (patch)
treec0fbd9dd5513d43f0bf0ba84bd91a3117409078f /src
parentRead function is good (diff)
downloadlowbat-bsd-754010fba962a7fe859e7f2efb977ec4eff04920.tar.gz
lowbat-bsd-754010fba962a7fe859e7f2efb977ec4eff04920.tar.bz2
lowbat-bsd-754010fba962a7fe859e7f2efb977ec4eff04920.tar.xz
lowbat-bsd-754010fba962a7fe859e7f2efb977ec4eff04920.tar.zst
lowbat-bsd-754010fba962a7fe859e7f2efb977ec4eff04920.zip
Better read function
Diffstat (limited to 'src')
-rw-r--r--src/jo_lowbat.h5
-rw-r--r--src/jo_main.c8
-rw-r--r--src/jo_main.h1
3 files changed, 8 insertions, 6 deletions
diff --git a/src/jo_lowbat.h b/src/jo_lowbat.h
index ddc6679..b39243e 100644
--- a/src/jo_lowbat.h
+++ b/src/jo_lowbat.h
@@ -13,11 +13,14 @@
#ifndef JO_LOWBAT_H
#define JO_LOWBAT_H
+#include <inttypes.h>
+
enum
{
JO_RET_FINE,
JO_RET_RD_FAILED
};
-char *jo_f_status(void);
+
+int8_t jo_f_status(void);
#endif
diff --git a/src/jo_main.c b/src/jo_main.c
index 2d19ab8..e5576b3 100644
--- a/src/jo_main.c
+++ b/src/jo_main.c
@@ -21,13 +21,11 @@
int
main(void)
{
- char *status;
+ int8_t status;
- if (!(status = jo_f_status())) {
+ if ((status = jo_f_status()) < 0) {
return (JO_RET_RD_FAILED);
}
- printf("status: %s\n", status);
- free(status);
- status = NULL;
+ printf("status: %d\n", status);
return (JO_RET_FINE);
}
diff --git a/src/jo_main.h b/src/jo_main.h
index 8feabe9..742f1d9 100644
--- a/src/jo_main.h
+++ b/src/jo_main.h
@@ -17,5 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
+#include <inttypes.h>
#endif