]> git.klezlab.it Git - klez/bat.git/commitdiff
fixed indentation master
authorFederico klez Culloca <klez@klezlab.it>
Sat, 13 Jun 2026 20:13:17 +0000 (22:13 +0200)
committerFederico klez Culloca <klez@klezlab.it>
Sat, 13 Jun 2026 20:13:50 +0000 (22:13 +0200)
bat.c

diff --git a/bat.c b/bat.c
index 849a8976426496b3ffae9ce8627e476a1da6dd82..56fa675087129a799639d327f5cf294c5c8f1e04 100644 (file)
--- a/bat.c
+++ b/bat.c
 
 int main(void)
 {
 
 int main(void)
 {
-       const int apmf = open("/dev/apm", O_RDONLY);
+    const int apmf = open("/dev/apm", O_RDONLY);
 
 
-       if (apmf == -1) {
-               goto print_error;
-       }
+    if (apmf == -1) {
+        goto print_error;
+    }
 
 
-       struct apm_power_info api;
+    struct apm_power_info api;
 
 
-       if (ioctl(apmf, APM_IOC_GETPOWER, &api) == 0) {
-               if ( close(apmf) != 0 ) {
-                       goto print_error;
-               }
+    if (ioctl(apmf, APM_IOC_GETPOWER, &api) == 0) {
+        if ( close(apmf) != 0 ) {
+            goto print_error;
+        }
 
 
-               const char* ac_state = api.ac_state == APM_AC_OFF ? "BAT" : "AC";
+        const char* ac_state = api.ac_state == APM_AC_OFF ? "BAT" : "AC";
 
 
-               printf("%s - %hhu%%"
-                               , ac_state
-                               , api.battery_life);
+        printf("%s - %hhu%%"
+             , ac_state
+             , api.battery_life);
 
 
-               if (api.minutes_left != UINT_MAX) {
-                       printf(" - %u min", api.minutes_left);
-               }
+        if (api.minutes_left != UINT_MAX) {
+            printf(" - %u min", api.minutes_left);
+        }
 
         printf("\n");
 
 
         printf("\n");
 
-               return EXIT_SUCCESS;
-       }
+        return EXIT_SUCCESS;
+    }
 
 print_error:
 
 print_error:
-       fprintf(stderr, "Error: %s", strerror(errno));
-       return EXIT_FAILURE;
+    fprintf(stderr, "Error: %s", strerror(errno));
+    return EXIT_FAILURE;
 }
 }