From 6a49f7ed8c72ed461b9b3613aa61bf7afda1adfd Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 21 Mar 2016 15:56:15 +0100 Subject: [PATCH] Add missing license, copyright and module description Signed-off-by: Joachim Nilsson --- cond-w.c | 23 +++++++++++++++++++++++ cond.c | 16 ++++++++-------- plugins/pidfile.c | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/cond-w.c b/cond-w.c index 028da129..a9bc82d4 100644 --- a/cond-w.c +++ b/cond-w.c @@ -1,3 +1,26 @@ +/* Condition engine (write) + * + * Copyright (c) 2015-2016 Tobias Waldekranz + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + #include #include #include diff --git a/cond.c b/cond.c index 07ff6c78..344104cf 100644 --- a/cond.c +++ b/cond.c @@ -1,6 +1,6 @@ -/* Event aggregator, also serves as event cache, remembering GW and IFUP states +/* Condition engine (read) * - * Copyright (c) 2015 Joachim Nilsson + * Copyright (c) 2015-2016 Tobias Waldekranz * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -53,6 +53,7 @@ const char *cond_path(const char *name) static char file[MAX_ARG_LEN]; snprintf(file, sizeof(file), COND_PATH "/%s", name); + return file; } @@ -77,10 +78,9 @@ enum cond_state cond_get(const char *name) enum cond_state cond_get_agg(const char *names) { - static char conds[MAX_ARG_LEN]; - - enum cond_state s = COND_ON; char *cond; + enum cond_state s = COND_ON; + static char conds[MAX_ARG_LEN]; if (!names) return COND_ON; @@ -94,17 +94,17 @@ enum cond_state cond_get_agg(const char *names) int cond_affects(const char *name, const char *names) { - static char conds[MAX_ARG_LEN]; - char *cond; + static char conds[MAX_ARG_LEN]; if (!name || !names) return 0; strlcpy(conds, names, sizeof(conds)); - for (cond = strtok(conds, ","); cond; cond = strtok(NULL, ",")) + for (cond = strtok(conds, ","); cond; cond = strtok(NULL, ",")) { if (!strcmp(cond, name)) return 1; + } return 0; } diff --git a/plugins/pidfile.c b/plugins/pidfile.c index 7439883a..d8542bc7 100644 --- a/plugins/pidfile.c +++ b/plugins/pidfile.c @@ -1,3 +1,26 @@ +/* Simple pidfile event monitor for the Finit condition engine + * + * Copyright (c) 2015-2016 Tobias Waldekranz + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + #include #include