diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-03-26 16:31:52 +0100 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-03-26 16:31:52 +0100 |
commit | 36f4495deee8611f2fc4c62e54616d52f5c25979 (patch) | |
tree | 4c9579bd02124c34c543f874c5b4f5d40ef957ba /lib/utils_cmd.c | |
parent | 066b6e68242b5e7a6f1eb665df9b227d896aec66 (diff) | |
download | monitoring-plugins-36f4495deee8611f2fc4c62e54616d52f5c25979.tar.gz |
Rename output to cmd_output
Diffstat (limited to 'lib/utils_cmd.c')
-rw-r--r-- | lib/utils_cmd.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 795840d3..2dc5deb0 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c | |||
@@ -70,7 +70,7 @@ extern char **environ; | |||
70 | static int _cmd_open (char *const *, int *, int *) | 70 | static int _cmd_open (char *const *, int *, int *) |
71 | __attribute__ ((__nonnull__ (1, 2, 3))); | 71 | __attribute__ ((__nonnull__ (1, 2, 3))); |
72 | 72 | ||
73 | static int _cmd_fetch_output (int, output *, int) | 73 | static int _cmd_fetch_output (int, cmd_output *, int) |
74 | __attribute__ ((__nonnull__ (2))); | 74 | __attribute__ ((__nonnull__ (2))); |
75 | 75 | ||
76 | static int _cmd_close (int); | 76 | static int _cmd_close (int); |
@@ -196,7 +196,7 @@ _cmd_close (int fd) | |||
196 | 196 | ||
197 | 197 | ||
198 | static int | 198 | static int |
199 | _cmd_fetch_output (int fd, output * op, int flags) | 199 | _cmd_fetch_output (int fd, cmd_output * op, int flags) |
200 | { | 200 | { |
201 | size_t len = 0, i = 0, lineno = 0; | 201 | size_t len = 0, i = 0, lineno = 0; |
202 | size_t rsf = 6, ary_size = 0; /* rsf = right shift factor, dec'ed uncond once */ | 202 | size_t rsf = 6, ary_size = 0; /* rsf = right shift factor, dec'ed uncond once */ |
@@ -267,9 +267,8 @@ _cmd_fetch_output (int fd, output * op, int flags) | |||
267 | 267 | ||
268 | 268 | ||
269 | int | 269 | int |
270 | cmd_run (const char *cmdstring, output * out, output * err, int flags) | 270 | cmd_run (const char *cmdstring, cmd_output * out, cmd_output * err, int flags) |
271 | { | 271 | { |
272 | int fd, pfd_out[2], pfd_err[2]; | ||
273 | int i = 0, argc; | 272 | int i = 0, argc; |
274 | size_t cmdlen; | 273 | size_t cmdlen; |
275 | char **argv = NULL; | 274 | char **argv = NULL; |
@@ -281,9 +280,9 @@ cmd_run (const char *cmdstring, output * out, output * err, int flags) | |||
281 | 280 | ||
282 | /* initialize the structs */ | 281 | /* initialize the structs */ |
283 | if (out) | 282 | if (out) |
284 | memset (out, 0, sizeof (output)); | 283 | memset (out, 0, sizeof (cmd_output)); |
285 | if (err) | 284 | if (err) |
286 | memset (err, 0, sizeof (output)); | 285 | memset (err, 0, sizeof (cmd_output)); |
287 | 286 | ||
288 | /* make copy of command string so strtok() doesn't silently modify it */ | 287 | /* make copy of command string so strtok() doesn't silently modify it */ |
289 | /* (the calling program may want to access it later) */ | 288 | /* (the calling program may want to access it later) */ |
@@ -342,15 +341,15 @@ cmd_run (const char *cmdstring, output * out, output * err, int flags) | |||
342 | } | 341 | } |
343 | 342 | ||
344 | int | 343 | int |
345 | cmd_run_array (char *const *argv, output * out, output * err, int flags) | 344 | cmd_run_array (char *const *argv, cmd_output * out, cmd_output * err, int flags) |
346 | { | 345 | { |
347 | int fd, pfd_out[2], pfd_err[2]; | 346 | int fd, pfd_out[2], pfd_err[2]; |
348 | 347 | ||
349 | /* initialize the structs */ | 348 | /* initialize the structs */ |
350 | if (out) | 349 | if (out) |
351 | memset (out, 0, sizeof (output)); | 350 | memset (out, 0, sizeof (cmd_output)); |
352 | if (err) | 351 | if (err) |
353 | memset (err, 0, sizeof (output)); | 352 | memset (err, 0, sizeof (cmd_output)); |
354 | 353 | ||
355 | if ((fd = _cmd_open (argv, pfd_out, pfd_err)) == -1) | 354 | if ((fd = _cmd_open (argv, pfd_out, pfd_err)) == -1) |
356 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), argv[0]); | 355 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), argv[0]); |
@@ -364,11 +363,11 @@ cmd_run_array (char *const *argv, output * out, output * err, int flags) | |||
364 | } | 363 | } |
365 | 364 | ||
366 | int | 365 | int |
367 | cmd_file_read ( char *filename, output *out, int flags) | 366 | cmd_file_read ( char *filename, cmd_output *out, int flags) |
368 | { | 367 | { |
369 | int fd; | 368 | int fd; |
370 | if(out) | 369 | if(out) |
371 | memset (out, 0, sizeof(output)); | 370 | memset (out, 0, sizeof(cmd_output)); |
372 | 371 | ||
373 | if ((fd = open(filename, O_RDONLY)) == -1) { | 372 | if ((fd = open(filename, O_RDONLY)) == -1) { |
374 | die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) ); | 373 | die( STATE_UNKNOWN, _("Error opening %s: %s"), filename, strerror(errno) ); |