#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
|
int | systemf (const char *fmt,...) |
| Like system(), but takes a formatted string as argument. More...
|
|
- Author
- Joachim Wiberg
- Date
- 2021
- Copyright
- ISC License
◆ systemf()
int systemf |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Like system(), but takes a formatted string as argument.
- Parameters
-
fmt | printf style format list to command to run |
This system() wrapper greatly simplifies operations that usually consist of composing a command from parts into a dynamic buffer before calling it. The return value from system() is also parsed, checking for proper exit and signals.
- Returns
- If the command exits normally, the return code of the command is returned. Otherwise, if the command is signalled, the return code is -1 and errno is set to
EINTR
.