mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 09:57:09 +00:00
smart: importing common.{h,c} from munin-c
The compilation is very easy, a simple `make` should work, as I provided a convenient `Makefile`
This commit is contained in:
parent
a420c4eb58
commit
6eff786eef
4 changed files with 145 additions and 1 deletions
45
plugins/disk/smart-c/common.h
Normal file
45
plugins/disk/smart-c/common.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (C) 2008 Helmut Grohne <helmut@subdivi.de> - All rights reserved.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU General Public License v.2 or v.3.
|
||||
*/
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#define PROC_STAT "/proc/stat"
|
||||
|
||||
/** Write yes to stdout and return 0. The intended use is give an autoconf
|
||||
* response like "return writeyes();".
|
||||
* @returns a success state to be passed on as the return value from main */
|
||||
int writeyes(void);
|
||||
|
||||
/** Answer an autoconf request by checking the readability of the given file.
|
||||
*/
|
||||
int autoconf_check_readable(const char *);
|
||||
|
||||
/** Obtain an integer value from the environment. In the absence of the
|
||||
* variable the given defaultvalue is returned. */
|
||||
int getenvint(const char *, int defaultvalue);
|
||||
|
||||
/** Print a name.warning line using the "name_warning" or "warning" environment
|
||||
* variables. */
|
||||
void print_warning(const char *name);
|
||||
|
||||
/** Print a name.critical line using the "name_critical" or "critical"
|
||||
* environment variables. */
|
||||
void print_critical(const char *name);
|
||||
|
||||
/** Print both name.warning and name.critical lines using environment
|
||||
* variables. */
|
||||
void print_warncrit(const char *name);
|
||||
|
||||
/** Fail by printing the given message and a newline to stderr.
|
||||
* @returns a failure state to be passed on as the return value from main */
|
||||
int fail(const char *message);
|
||||
|
||||
#define xisspace(x) isspace((int)(unsigned char) x)
|
||||
#define xisdigit(x) isdigit((int)(unsigned char) x)
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue