Whitespace fixes in lib

This commit is contained in:
RincewindsHat 2023-10-15 18:17:36 +02:00
parent b1801c1084
commit 4b9d90f31c
16 changed files with 104 additions and 106 deletions

View file

@ -1,23 +1,23 @@
/*****************************************************************************
*
*
* Monitoring Plugins extra_opts library
*
*
* License: GPL
* Copyright (c) 2007 Monitoring Plugins Development Team
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*****************************************************************************/
#include "common.h"

View file

@ -1,24 +1,24 @@
/*****************************************************************************
*
*
* Monitoring Plugins parse_ini library
*
*
* License: GPL
* Copyright (c) 2007 Monitoring Plugins Development Team
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"

View file

@ -1,19 +1,19 @@
/*****************************************************************************
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"

View file

@ -1,19 +1,19 @@
/*****************************************************************************
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"

View file

@ -1,19 +1,19 @@
/*****************************************************************************
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"
@ -167,7 +167,7 @@ main (int argc, char **argv)
}
ok(found == 0, "first element successfully deleted");
found = 0;
p=paths;
while (p) {
if (! strcmp(p->name, "/tmp"))
@ -203,9 +203,9 @@ main (int argc, char **argv)
}
void
void
np_test_mount_entry_regex (struct mount_entry *dummy_mount_list, char *regstr, int cflags, int expect, char *desc)
{
{
int matches = 0;
regex_t re;
struct mount_entry *me;
@ -214,7 +214,7 @@ np_test_mount_entry_regex (struct mount_entry *dummy_mount_list, char *regstr, i
if(np_regex_match_mount_entry(me,&re))
matches++;
}
ok( matches == expect,
ok( matches == expect,
"%s '%s' matched %i/3 entries. ok: %i/3",
desc, regstr, expect, matches);

View file

@ -1,19 +1,19 @@
/*****************************************************************************
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"

View file

@ -1,19 +1,19 @@
/*****************************************************************************
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "parse_ini.h"

View file

@ -12,7 +12,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*****************************************************************************/
#include "common.h"

View file

@ -1,19 +1,19 @@
/*****************************************************************************
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"
@ -33,7 +33,7 @@ main(void)
server_expect[0] = strdup("AA");
server_expect[1] = strdup("bb");
server_expect[2] = strdup("CC");
ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS,
"Test matching any string at the beginning (first expect string)");
ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS,
@ -52,7 +52,7 @@ main(void)
"Test not matching all strings");
ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY,
"Test not matching any string (testing all)");
return exit_status();
}

View file

@ -1,19 +1,19 @@
/*****************************************************************************
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"
@ -377,13 +377,13 @@ main (int argc, char **argv)
/*
temp_fp = fopen("var/statefile", "r");
if (temp_fp==NULL)
if (temp_fp==NULL)
printf("Error opening. errno=%d\n", errno);
printf("temp_fp=%s\n", temp_fp);
ok( _np_state_read_file(temp_fp) == TRUE, "Can read state file" );
ok( _np_state_read_file(temp_fp) == true, "Can read state file" );
fclose(temp_fp);
*/
temp_state_key->_filename="var/statefile";
temp_state_data = np_state_read();
ok( this_monitoring_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not");
@ -446,14 +446,14 @@ main (int argc, char **argv)
/* Check time is set to current_time */
ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time");
ok(this_monitoring_plugin->state->state_data->time-current_time<=1, "Has time generated from current time");
/* Don't know how to automatically test this. Need to be able to redefine die and catch the error */
/*
temp_state_key->_filename="/dev/do/not/expect/to/be/able/to/write";
np_state_write_string(0, "Bad file");
*/
np_cleanup();
@ -508,4 +508,3 @@ main (int argc, char **argv)
return exit_status();
}

View file

@ -6,21 +6,21 @@
* Copyright (c) 2006 Monitoring Plugins Development Team
*
* Library of useful functions for plugins
*
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*****************************************************************************/
@ -640,10 +640,10 @@ int _np_state_read_file(FILE *f) {
}
/*
* If time=NULL, use current time. Create state file, with state format
* version, default text. Writes version, time, and data. Avoid locking
* problems - use mv to write and then swap. Possible loss of state data if
* two things writing to same key at same time.
* If time=NULL, use current time. Create state file, with state format
* version, default text. Writes version, time, and data. Avoid locking
* problems - use mv to write and then swap. Possible loss of state data if
* two things writing to same key at same time.
* Will die with UNKNOWN if errors
*/
void np_state_write_string(time_t data_time, char *data_string) {
@ -658,7 +658,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
time(&current_time);
else
current_time=data_time;
/* If file doesn't currently exist, create directories */
if(access(this_monitoring_plugin->state->_filename,F_OK)!=0) {
result = asprintf(&directories, "%s", this_monitoring_plugin->state->_filename);
@ -697,15 +697,15 @@ void np_state_write_string(time_t data_time, char *data_string) {
np_free(temp_file);
die(STATE_UNKNOWN, _("Unable to open temporary state file"));
}
fprintf(fp,"# NP State file\n");
fprintf(fp,"%d\n",NP_STATE_FORMAT_VERSION);
fprintf(fp,"%d\n",this_monitoring_plugin->state->data_version);
fprintf(fp,"%lu\n",current_time);
fprintf(fp,"%s\n",data_string);
fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP);
fflush(fp);
result=fclose(fp);

View file

@ -6,7 +6,7 @@
# include "sha256.h"
#endif
/* This file holds header information for thresholds - use this in preference to
/* This file holds header information for thresholds - use this in preference to
individual plugin logic */
/* This has not been merged with utils.h because of problems with
@ -79,7 +79,7 @@ void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3)))
#define NP_RANGE_UNPARSEABLE 1
#define NP_WARN_WITHIN_CRIT 2
/* a simple check to see if we're running as root.
/* a simple check to see if we're running as root.
* returns zero on failure, nonzero on success */
int np_check_if_root(void);

View file

@ -18,18 +18,18 @@
* Care has been taken to make sure the functions are async-safe. The one
* function which isn't is cmd_init() which it doesn't make sense to
* call twice anyway, so the api as a whole should be considered async-safe.
*
*
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@ -377,10 +377,10 @@ cmd_file_read ( char *filename, output *out, int flags)
if ((fd = open(filename, O_RDONLY)) == -1) {
die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) );
}
if(out)
out->lines = _cmd_fetch_output (fd, out, flags);
if (close(fd) == -1)
die( STATE_UNKNOWN, _("Error closing %s: %s"), filename, strerror(errno) );

View file

@ -1,10 +1,10 @@
#ifndef _UTILS_CMD_
#define _UTILS_CMD_
/*
/*
* Header file for Monitoring Plugins utils_cmd.c
*
*
*
*
*/
/** types **/

View file

@ -1,29 +1,29 @@
/*****************************************************************************
*
*
* Library for check_disk
*
*
* License: GPL
* Copyright (c) 1999-2007 Monitoring Plugins Development Team
*
*
* Description:
*
*
* This file contains utilities for check_disk. These are tested by libtap
*
*
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"
@ -98,7 +98,7 @@ np_add_parameter(struct parameter_list **list, const char *name)
new_path->freeinodes_percent = NULL;
new_path->group = NULL;
new_path->dfree_pct = -1;
new_path->dused_pct = -1;
new_path->dused_pct = -1;
new_path->total = 0;
new_path->available = 0;
new_path->available_to_root = 0;
@ -279,4 +279,3 @@ np_regex_match_mount_entry (struct mount_entry* me, regex_t* re)
return FALSE;
}
}

View file

@ -1,29 +1,29 @@
/*****************************************************************************
*
*
* Library for check_tcp
*
*
* License: GPL
* Copyright (c) 1999-2013 Monitoring Plugins Development Team
*
*
* Description:
*
*
* This file contains utilities for check_tcp. These are tested by libtap
*
*
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*****************************************************************************/
#include "common.h"