diff options
| author | Mattias Andrée <m@maandree.se> | 2026-02-22 13:47:21 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-02-22 13:47:21 +0100 |
| commit | bd3cda801449f0ed0630637a843d8d9d6a964daa (patch) | |
| tree | 334020796b730b150ee274e595e650325b1b858c /src/common.c | |
| parent | m makefile (diff) | |
| download | cerberus-logging-bd3cda801449f0ed0630637a843d8d9d6a964daa.tar.gz cerberus-logging-bd3cda801449f0ed0630637a843d8d9d6a964daa.tar.bz2 cerberus-logging-bd3cda801449f0ed0630637a843d8d9d6a964daa.tar.xz | |
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | src/common.c | 34 |
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(); +} |
