aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/common.c b/src/common.c
index 78b3383..1600a80 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,7 +1,7 @@
/**
* cerberus-logging – Log-in logging extension for cerberus
*
- * Copyright © 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright © 2014, 2015 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,26 +19,24 @@
#include "common.h"
-#define X(A) const char* A = NULL;
- LIST_ARGUMENTS
+#define X(A) const char *A = NULL;
+LIST_ARGUMENTS
#undef X
-int main(int argc, char** argv)
+int
+main(int argc, char **argv)
{
- int i;
-
- for (i = 1; i < argc; i++)
- {
-#define X(A) if (strstr(argv[i], "--" #A "=")) A = strchr(argv[i], '=') + 1;
- LIST_ARGUMENTS
+ int i;
+
+ for (i = 1; i < argc; i++) {
+#define X(A) if (strstr(argv[i], "--" #A "=")) A = &strchr(argv[i], '=')[1];
+ LIST_ARGUMENTS
#undef X
- }
-
- if (NULL == username) return 1;
- if (NULL == ttyname) return 1;
- if (NULL == pid) return 1;
-
- return -do_log();
-}
+ }
+ if (!username || !ttyname || !pid)
+ return 1;
+
+ return -do_log();
+}