2021-06-17 21:32:24 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
2022-03-14 23:09:25 +00:00
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <fcntl.h>
|
2021-06-17 21:32:24 +00:00
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
#include "string.h"
|
|
|
|
#include "util.h"
|
|
|
|
|
2022-03-14 23:09:25 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-06-17 21:32:24 +00:00
|
|
|
// Safe execvpe()
|
2022-03-14 23:09:25 +00:00
|
|
|
__attribute__((noreturn)) void safe_execvpe(const char *const argv[], const char *const envp[]);
|
2022-03-09 23:47:31 +00:00
|
|
|
|
|
|
|
// Chop Off Last Component
|
2022-03-14 23:09:25 +00:00
|
|
|
void chop_last_component(char **str);
|
2021-06-17 21:32:24 +00:00
|
|
|
// Get Binary Directory (Remember To Free)
|
2022-03-14 23:09:25 +00:00
|
|
|
char *get_binary_directory();
|
2022-03-09 23:47:31 +00:00
|
|
|
|
2021-06-17 21:32:24 +00:00
|
|
|
// Safe execvpe() Relative To Binary
|
2022-03-14 23:09:25 +00:00
|
|
|
__attribute__((noreturn)) void safe_execvpe_relative_to_binary(const char *const argv[], const char *const envp[]);
|
2022-03-09 23:47:31 +00:00
|
|
|
|
|
|
|
// Get MCPI Directory
|
2022-03-14 23:09:25 +00:00
|
|
|
char *get_mcpi_directory();
|
|
|
|
|
|
|
|
// Run Command And Get Output
|
|
|
|
char *run_command(const char *const command[], int *return_code);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2022-03-09 23:47:31 +00:00
|
|
|
}
|
2022-03-14 23:09:25 +00:00
|
|
|
#endif
|