summaryrefslogtreecommitdiff
path: root/src/include/gauger.h
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-08-25 16:18:24 +0200
committerFlorian Dold <florian.dold@gmail.com>2019-08-25 16:18:24 +0200
commiteb559970846f0fa27f1f25c482cd07210a56f4b1 (patch)
tree8526637825e520e1420b17515934ced794a33c01 /src/include/gauger.h
parent3742239c13001433eeade439a0e0490f07351c43 (diff)
downloadexchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.tar.gz
exchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.tar.bz2
exchange-eb559970846f0fa27f1f25c482cd07210a56f4b1.zip
re-format code
Diffstat (limited to 'src/include/gauger.h')
-rw-r--r--src/include/gauger.h150
1 files changed, 76 insertions, 74 deletions
diff --git a/src/include/gauger.h b/src/include/gauger.h
index 9fa34b9b..7d66051b 100644
--- a/src/include/gauger.h
+++ b/src/include/gauger.h
@@ -17,65 +17,65 @@
#include <stdio.h>
#include <sys/wait.h>
-#define GAUGER(category, counter, value, unit)\
-{\
- const char * __gauger_v[10]; \
- char __gauger_s[32];\
- pid_t __gauger_p;\
- if(!(__gauger_p=fork())){\
- if(!fork()){\
- sprintf(__gauger_s,"%Lf", (long double) (value));\
- __gauger_v[0] = "gauger";\
- __gauger_v[1] = "-n";\
- __gauger_v[2] = (char *) counter; \
- __gauger_v[3] = "-d";\
- __gauger_v[4] = __gauger_s;\
- __gauger_v[5] = "-u";\
- __gauger_v[6] = (char *) unit; \
- __gauger_v[7] = "-c";\
- __gauger_v[8] = (char *) category; \
- __gauger_v[9] = (char *) NULL;\
- execvp("gauger", (char*const*) __gauger_v); \
- perror("gauger");\
- _exit(1);\
- }else{\
- _exit(0);\
- }\
- }else{\
- waitpid(__gauger_p,NULL,0);\
- }\
-}
+#define GAUGER(category, counter, value, unit) \
+ { \
+ const char *__gauger_v[10]; \
+ char __gauger_s[32]; \
+ pid_t __gauger_p; \
+ if (! (__gauger_p = fork ())) { \
+ if (! fork ()) { \
+ sprintf (__gauger_s,"%Lf", (long double) (value)); \
+ __gauger_v[0] = "gauger"; \
+ __gauger_v[1] = "-n"; \
+ __gauger_v[2] = (char *) counter; \
+ __gauger_v[3] = "-d"; \
+ __gauger_v[4] = __gauger_s; \
+ __gauger_v[5] = "-u"; \
+ __gauger_v[6] = (char *) unit; \
+ __gauger_v[7] = "-c"; \
+ __gauger_v[8] = (char *) category; \
+ __gauger_v[9] = (char *) NULL; \
+ execvp ("gauger", (char*const*) __gauger_v); \
+ perror ("gauger"); \
+ _exit (1); \
+ }else{ \
+ _exit (0); \
+ } \
+ }else{ \
+ waitpid (__gauger_p,NULL,0); \
+ } \
+ }
-#define GAUGER_ID(category, counter, value, unit, id)\
-{\
- char* __gauger_v[12];\
- char __gauger_s[32];\
- pid_t __gauger_p;\
- if(!(__gauger_p=fork())){\
- if(!fork()){\
- sprintf(__gauger_s,"%Lf", (long double) (value));\
- __gauger_v[0] = "gauger";\
- __gauger_v[1] = "-n";\
- __gauger_v[2] = (char *) counter; \
- __gauger_v[3] = "-d";\
- __gauger_v[4] = __gauger_s;\
- __gauger_v[5] = "-u";\
- __gauger_v[6] = (char *) unit; \
- __gauger_v[7] = "-i";\
- __gauger_v[8] = id;\
- __gauger_v[9] = "-c";\
- __gauger_v[10] = (char *) category; \
- __gauger_v[11] = (char *) NULL;\
- execvp("gauger",__gauger_v);\
- perror("gauger");\
- _exit(1);\
- }else{\
- _exit(0);\
- }\
- }else{\
- waitpid(__gauger_p,NULL,0);\
- }\
-}
+#define GAUGER_ID(category, counter, value, unit, id) \
+ { \
+ char*__gauger_v[12]; \
+ char __gauger_s[32]; \
+ pid_t __gauger_p; \
+ if (! (__gauger_p = fork ())) { \
+ if (! fork ()) { \
+ sprintf (__gauger_s,"%Lf", (long double) (value)); \
+ __gauger_v[0] = "gauger"; \
+ __gauger_v[1] = "-n"; \
+ __gauger_v[2] = (char *) counter; \
+ __gauger_v[3] = "-d"; \
+ __gauger_v[4] = __gauger_s; \
+ __gauger_v[5] = "-u"; \
+ __gauger_v[6] = (char *) unit; \
+ __gauger_v[7] = "-i"; \
+ __gauger_v[8] = id; \
+ __gauger_v[9] = "-c"; \
+ __gauger_v[10] = (char *) category; \
+ __gauger_v[11] = (char *) NULL; \
+ execvp ("gauger",__gauger_v); \
+ perror ("gauger"); \
+ _exit (1); \
+ }else{ \
+ _exit (0); \
+ } \
+ }else{ \
+ waitpid (__gauger_p,NULL,0); \
+ } \
+ }
#else /* WINDOWS */
@@ -83,25 +83,27 @@
#include <stdio.h>
#include <windef.h>
-#define GAUGER(category, counter, value, unit)\
-{\
- char __gauger_commandline[MAX_PATH];\
+#define GAUGER(category, counter, value, unit) \
+ { \
+ char __gauger_commandline[MAX_PATH]; \
\
- snprintf (__gauger_commandline, MAX_PATH, "gauger.py -n \"%s\" -d \"%Lf\" -u \"%s\" -c \"%s\"",\
- counter, (long double) (value), unit, category);\
- __gauger_commandline[MAX_PATH - 1] = '\0';\
- system (__gauger_commandline);\
-}
+ snprintf (__gauger_commandline, MAX_PATH, \
+ "gauger.py -n \"%s\" -d \"%Lf\" -u \"%s\" -c \"%s\"", \
+ counter, (long double) (value), unit, category); \
+ __gauger_commandline[MAX_PATH - 1] = '\0'; \
+ system (__gauger_commandline); \
+ }
-#define GAUGER_ID(category, counter, value, unit, id)\
-{\
- char __gauger_commandline[MAX_PATH];\
+#define GAUGER_ID(category, counter, value, unit, id) \
+ { \
+ char __gauger_commandline[MAX_PATH]; \
\
- snprintf (__gauger_commandline, MAX_PATH, "gauger.py -n \"%s\" -d \"%Lf\" -u \"%s\" -i \"%s\" -c \"%s\"",\
- counter, (long double) (value), unit, id, category);\
- __gauger_commandline[MAX_PATH - 1] = '\0';\
- system (__gauger_commandline);\
-}
+ snprintf (__gauger_commandline, MAX_PATH, \
+ "gauger.py -n \"%s\" -d \"%Lf\" -u \"%s\" -i \"%s\" -c \"%s\"", \
+ counter, (long double) (value), unit, id, category); \
+ __gauger_commandline[MAX_PATH - 1] = '\0'; \
+ system (__gauger_commandline); \
+ }
#endif // WINDOWS