libite
Functions
systemf.c File Reference
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
Include dependency graph for systemf.c:

Functions

int systemf (const char *fmt,...)
 Like system(), but takes a formatted string as argument. More...
 

Detailed Description

Author
Joachim Wiberg
Date
2021

Function Documentation

◆ systemf()

int systemf ( const char *  fmt,
  ... 
)

Like system(), but takes a formatted string as argument.

Parameters
fmtprintf 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.