mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 09:57:09 +00:00
extract function getenvint to common.c
This commit is contained in:
parent
50b2baaf69
commit
c01ddbb0c0
3 changed files with 13 additions and 13 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int writeyes(void) {
|
||||
puts("yes");
|
||||
|
@ -12,3 +13,11 @@ int writeno(const char *s) {
|
|||
puts("no");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getenvint(const char *name, int defvalue) {
|
||||
const char *value;
|
||||
value = getenv(name);
|
||||
if(value == NULL)
|
||||
return defvalue;
|
||||
return atoi(value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue