summaryrefslogtreecommitdiff
path: root/src/process_runs.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2015-03-16 10:00:32 +0100
committerMichael Stapelberg <michael@stapelberg.de>2015-03-16 10:01:07 +0100
commitd74e904bf4bdd7f1d767a8db09987b90de809579 (patch)
tree07ab4f610c2f222a662daf417f1356154806c29e /src/process_runs.c
parent6996f0a4a34e0744f09dbce39a2164c6fcee875e (diff)
clang-format-3.5 -i **/*.[ch], update modeline
From here on, we’ll use clang-format to automatically format the source. This has worked well in i3, so we are introducing it for i3status.
Diffstat (limited to 'src/process_runs.c')
-rw-r--r--src/process_runs.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/process_runs.c b/src/process_runs.c
index 1836507..b5e8f11 100644
--- a/src/process_runs.c
+++ b/src/process_runs.c
@@ -1,4 +1,4 @@
-// vim:ts=8:sw=8:expandtab
+// vim:ts=4:sw=4:expandtab
#include <stdbool.h>
#include <glob.h>
#include <string.h>
@@ -20,30 +20,30 @@
*
*/
bool process_runs(const char *path) {
- static char pidbuf[16];
- static glob_t globbuf;
- memset(pidbuf, 0, sizeof(pidbuf));
+ static char pidbuf[16];
+ static glob_t globbuf;
+ memset(pidbuf, 0, sizeof(pidbuf));
- if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0)
- die("glob() failed\n");
- if (globbuf.gl_pathc == 0) {
- /* No glob matches, the specified path does not contain a wildcard. */
- globfree(&globbuf);
- if (!slurp(path, pidbuf, sizeof(pidbuf)))
- return false;
- return (kill(strtol(pidbuf, NULL, 10), 0) == 0 || errno == EPERM);
+ if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0)
+ die("glob() failed\n");
+ if (globbuf.gl_pathc == 0) {
+ /* No glob matches, the specified path does not contain a wildcard. */
+ globfree(&globbuf);
+ if (!slurp(path, pidbuf, sizeof(pidbuf)))
+ return false;
+ return (kill(strtol(pidbuf, NULL, 10), 0) == 0 || errno == EPERM);
+ }
+ for (size_t i = 0; i < globbuf.gl_pathc; i++) {
+ if (!slurp(globbuf.gl_pathv[i], pidbuf, sizeof(pidbuf))) {
+ globfree(&globbuf);
+ return false;
}
- for (size_t i = 0; i < globbuf.gl_pathc; i++) {
- if (!slurp(globbuf.gl_pathv[i], pidbuf, sizeof(pidbuf))) {
- globfree(&globbuf);
- return false;
- }
- if (kill(strtol(pidbuf, NULL, 10), 0) == 0 || errno == EPERM) {
- globfree(&globbuf);
- return true;
- }
+ if (kill(strtol(pidbuf, NULL, 10), 0) == 0 || errno == EPERM) {
+ globfree(&globbuf);
+ return true;
}
- globfree(&globbuf);
+ }
+ globfree(&globbuf);
- return false;
+ return false;
}