Back to index

nagios-plugins  1.4.16
runcmd.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 * 
00003 * License: GPL
00004 * Copyright (c) 2005 Nagios Plugins Development Team
00005 * Author: Andreas Ericsson <ae@op5.se>
00006 * 
00007 * 
00008 * This program is free software: you can redistribute it and/or modify
00009 * it under the terms of the GNU General Public License as published by
00010 * the Free Software Foundation, either version 3 of the License, or
00011 * (at your option) any later version.
00012 * 
00013 * This program is distributed in the hope that it will be useful,
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 * GNU General Public License for more details.
00017 * 
00018 * You should have received a copy of the GNU General Public License
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020 * 
00021 * 
00022 *****************************************************************************/
00023 
00024 #ifndef NAGIOSPLUG_RUNCMD_H
00025 #define NAGIOSPLUG_RUNCMD_H
00026 
00027 #include "common.h"
00028 
00030 struct output {
00031        char *buf;     /* output buffer */
00032        size_t buflen; /* output buffer content length */
00033        char **line;   /* array of lines (points to buf) */
00034        size_t *lens;  /* string lengths */
00035        size_t lines;  /* lines of output */
00036 };
00037 
00038 typedef struct output output;
00039 
00041 int np_runcmd(const char *, output *, output *, int);
00042 void popen_timeout_alarm_handler(int)
00043        __attribute__((__noreturn__));
00044 
00045 /* only multi-threaded plugins need to bother with this */
00046 void np_runcmd_init(void);
00047 #define NP_RUNCMD_INIT np_runcmd_init()
00048 
00049 /* possible flags for np_runcmd()'s fourth argument */
00050 #define RUNCMD_NO_ARRAYS 0x01 /* don't populate arrays at all */
00051 #define RUNCMD_NO_ASSOC 0x02  /* output.line won't point to buf */
00052 
00053 #endif /* NAGIOSPLUG_RUNCMD_H */