Recreate base64 project
This commit is contained in:
102
wapp/core/os/shell/commander/commander.c
Normal file
102
wapp/core/os/shell/commander/commander.c
Normal file
@@ -0,0 +1,102 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "commander.h"
|
||||
#include "commander_output.h"
|
||||
#include "../utils/shell_utils.h"
|
||||
#include "../../../mem/arena/mem_arena_allocator.h"
|
||||
#include "../../../../common/aliases/aliases.h"
|
||||
#include "../../../../common/misc/misc_utils.h"
|
||||
#include "../../../../primitives/dbl_list/dbl_list.h"
|
||||
#include "../../../../primitives/mem_allocator/mem_allocator.h"
|
||||
#include "../../../../primitives/strings/str8/str8.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define CMD_BUF_LEN 8192
|
||||
#define OUT_BUF_LEN 4096
|
||||
|
||||
internal inline CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf);
|
||||
internal inline CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf);
|
||||
|
||||
CMDResult wapp_shell_commander_execute(CMDOutHandling out_handling, Str8 *out_buf, const Str8List *cmd) {
|
||||
if (!cmd) {
|
||||
return CMD_NO_EXIT(SHELL_ERR_INVALID_ARGS);
|
||||
}
|
||||
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(500));
|
||||
|
||||
Str8 *cmd_str = wapp_str8_join(&arena, cmd, &wapp_str8_lit_ro(" "));
|
||||
if (!cmd_str) {
|
||||
wapp_mem_arena_allocator_destroy(&arena);
|
||||
return CMD_NO_EXIT(SHELL_ERR_ALLOCATION_FAIL);
|
||||
}
|
||||
|
||||
// Redirect output
|
||||
cmd_str = wapp_str8_alloc_concat(&arena, cmd_str, &wapp_str8_lit_ro(" 2>&1"));
|
||||
|
||||
CMDResult output = execute_command(cmd_str, out_handling, out_buf);
|
||||
|
||||
wapp_mem_arena_allocator_destroy(&arena);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
internal inline CMDResult execute_command(Str8RO *cmd, CMDOutHandling out_handling, Str8 *out_buf) {
|
||||
char cmd_buf[CMD_BUF_LEN] = {0};
|
||||
wapp_str8_copy_to_cstr(cmd_buf, cmd, CMD_BUF_LEN);
|
||||
|
||||
FILE *fp = wapp_shell_utils_popen(cmd_buf, "r");
|
||||
if (!fp) {
|
||||
return CMD_NO_EXIT(SHELL_ERR_PROC_START_FAIL);
|
||||
}
|
||||
|
||||
CMDResult output;
|
||||
|
||||
CMDError err = get_command_output(fp, out_handling, out_buf);
|
||||
if (err > SHELL_ERR_NO_ERROR) {
|
||||
output = CMD_NO_EXIT(err);
|
||||
goto EXECUTE_COMMAND_CLOSE;
|
||||
}
|
||||
|
||||
i32 st = EXIT_SUCCESS;
|
||||
err = get_output_status(fp, &st);
|
||||
if (err > SHELL_ERR_NO_ERROR) {
|
||||
output = CMD_NO_EXIT(err);
|
||||
goto EXECUTE_COMMAND_CLOSE;
|
||||
}
|
||||
|
||||
// Process is already closed in get_output_status
|
||||
fp = NULL;
|
||||
|
||||
output = (CMDResult){
|
||||
.exited = true,
|
||||
.exit_code = st,
|
||||
.error = SHELL_ERR_NO_ERROR,
|
||||
};
|
||||
|
||||
EXECUTE_COMMAND_CLOSE:
|
||||
if (fp) {
|
||||
wapp_shell_utils_pclose(fp);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
internal inline CMDError get_command_output(FILE *fp, CMDOutHandling out_handling, Str8 *out_buf) {
|
||||
Str8 out = wapp_str8_buf(OUT_BUF_LEN);
|
||||
|
||||
out.size = fread((void *)out.buf, sizeof(u8), out.capacity, fp);
|
||||
if (out_handling == SHELL_OUTPUT_CAPTURE && out_buf != NULL) {
|
||||
if (out.size >= out_buf->capacity) {
|
||||
return SHELL_ERR_OUT_BUF_FULL;
|
||||
}
|
||||
|
||||
wapp_str8_concat_capped(out_buf, &out);
|
||||
} else if (out_handling == SHELL_OUTPUT_PRINT) {
|
||||
printf(WAPP_STR8_SPEC, wapp_str8_varg(out));
|
||||
}
|
||||
|
||||
return SHELL_ERR_NO_ERROR;
|
||||
}
|
||||
28
wapp/core/os/shell/commander/commander.h
Normal file
28
wapp/core/os/shell/commander/commander.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef COMMANDER_H
|
||||
#define COMMANDER_H
|
||||
|
||||
#include "commander_output.h"
|
||||
#include "../../../../common/aliases/aliases.h"
|
||||
#include "../../../../common/platform/platform.h"
|
||||
#include "../../../../primitives/strings/str8/str8.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
#define CMD_NO_EXIT(ERR) ((CMDResult){.exited = false, .exit_code = EXIT_FAILURE, .error = ERR})
|
||||
|
||||
CMDResult wapp_shell_commander_execute(CMDOutHandling out_handling, Str8 *out_buf, const Str8List *cmd);
|
||||
|
||||
external CMDError get_output_status(FILE *fp, i32 *status_out);
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
#endif // !COMMANDER_H
|
||||
45
wapp/core/os/shell/commander/commander_output.h
Normal file
45
wapp/core/os/shell/commander/commander_output.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef COMMANDER_OUTPUT_H
|
||||
#define COMMANDER_OUTPUT_H
|
||||
|
||||
#include "../../../../common/aliases/aliases.h"
|
||||
#include "../../../../common/platform/platform.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
typedef enum {
|
||||
SHELL_OUTPUT_DISCARD,
|
||||
SHELL_OUTPUT_PRINT,
|
||||
SHELL_OUTPUT_CAPTURE,
|
||||
} CMDOutHandling;
|
||||
|
||||
typedef enum {
|
||||
SHELL_ERR_NO_ERROR,
|
||||
SHELL_ERR_INVALID_ARGS,
|
||||
SHELL_ERR_ALLOCATION_FAIL,
|
||||
SHELL_ERR_PROC_START_FAIL,
|
||||
SHELL_ERR_OUT_BUF_FULL,
|
||||
SHELL_ERR_PROC_EXIT_FAIL,
|
||||
} CMDError;
|
||||
|
||||
typedef struct commander_result CMDResult;
|
||||
struct commander_result {
|
||||
i32 exit_code;
|
||||
CMDError error;
|
||||
bool exited;
|
||||
|
||||
#ifdef WAPP_PLATFORM_WINDOWS
|
||||
#include "../../../../common/misc/misc_utils.h"
|
||||
wapp_misc_utils_padding_size(sizeof(bool) + sizeof(i32) + sizeof(CMDError));
|
||||
#endif // !WAPP_PLATFORM_WINDOWS
|
||||
};
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
#endif // !COMMANDER_OUTPUT_H
|
||||
25
wapp/core/os/shell/commander/posix/commander_posix.c
Normal file
25
wapp/core/os/shell/commander/posix/commander_posix.c
Normal file
@@ -0,0 +1,25 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "../../../../../common/aliases/aliases.h"
|
||||
#include "../../../../../common/platform/platform.h"
|
||||
|
||||
#ifdef WAPP_PLATFORM_POSIX
|
||||
|
||||
#include "../commander_output.h"
|
||||
#include "../../utils/shell_utils.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
CMDError get_output_status(FILE *fp, i32 *status_out) {
|
||||
*status_out = wapp_shell_utils_pclose(fp);
|
||||
|
||||
if (!WIFEXITED(*status_out)) {
|
||||
return SHELL_ERR_PROC_EXIT_FAIL;
|
||||
}
|
||||
|
||||
*status_out = WEXITSTATUS(*status_out);
|
||||
|
||||
return SHELL_ERR_NO_ERROR;
|
||||
}
|
||||
|
||||
#endif // !WAPP_PLATFORM_POSIX
|
||||
24
wapp/core/os/shell/commander/win/commander_win.c
Normal file
24
wapp/core/os/shell/commander/win/commander_win.c
Normal file
@@ -0,0 +1,24 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "../../../../../common/aliases/aliases.h"
|
||||
#include "../../../../../common/platform/platform.h"
|
||||
|
||||
#ifdef WAPP_PLATFORM_WINDOWS
|
||||
|
||||
#include "../commander_output.h"
|
||||
#include "../../utils/shell_utils.h"
|
||||
#include <stdio.h>
|
||||
|
||||
CMDError get_output_status(FILE *fp, i32 *status_out) {
|
||||
if (!feof(fp)) {
|
||||
// Ensure process is closed on failure
|
||||
wapp_shell_utils_pclose(fp);
|
||||
return SHELL_ERR_PROC_EXIT_FAIL;
|
||||
}
|
||||
|
||||
*status_out = wapp_shell_utils_pclose(fp);
|
||||
|
||||
return SHELL_ERR_NO_ERROR;
|
||||
}
|
||||
|
||||
#endif // !WAPP_PLATFORM_WINDOWS
|
||||
36
wapp/core/os/shell/termcolour/posix/termcolour_posix.c
Normal file
36
wapp/core/os/shell/termcolour/posix/termcolour_posix.c
Normal file
@@ -0,0 +1,36 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "../../../../../common/aliases/aliases.h"
|
||||
#include "../../../../../common/platform/platform.h"
|
||||
#include "../../../../../primitives/strings/str8/str8.h"
|
||||
|
||||
#ifdef WAPP_PLATFORM_POSIX
|
||||
|
||||
#include "../terminal_colours.h"
|
||||
#include <stdio.h>
|
||||
|
||||
internal Str8RO colours[COUNT_TERM_COLOUR] = {
|
||||
[WAPP_TERM_COLOUR_FG_BLACK] = wapp_str8_lit_ro_initialiser_list("\033[30m"),
|
||||
[WAPP_TERM_COLOUR_FG_RED] = wapp_str8_lit_ro_initialiser_list("\033[31m"),
|
||||
[WAPP_TERM_COLOUR_FG_GREEN] = wapp_str8_lit_ro_initialiser_list("\033[32m"),
|
||||
[WAPP_TERM_COLOUR_FG_BLUE] = wapp_str8_lit_ro_initialiser_list("\033[34m"),
|
||||
[WAPP_TERM_COLOUR_FG_CYAN] = wapp_str8_lit_ro_initialiser_list("\033[36m"),
|
||||
[WAPP_TERM_COLOUR_FG_MAGENTA] = wapp_str8_lit_ro_initialiser_list("\033[35m"),
|
||||
[WAPP_TERM_COLOUR_FG_YELLOW] = wapp_str8_lit_ro_initialiser_list("\033[33m"),
|
||||
[WAPP_TERM_COLOUR_FG_WHITE] = wapp_str8_lit_ro_initialiser_list("\033[37m"),
|
||||
[WAPP_TERM_COLOUR_FG_BR_BLACK] = wapp_str8_lit_ro_initialiser_list("\033[90m"),
|
||||
[WAPP_TERM_COLOUR_FG_BR_RED] = wapp_str8_lit_ro_initialiser_list("\033[91m"),
|
||||
[WAPP_TERM_COLOUR_FG_BR_GREEN] = wapp_str8_lit_ro_initialiser_list("\033[92m"),
|
||||
[WAPP_TERM_COLOUR_FG_BR_BLUE] = wapp_str8_lit_ro_initialiser_list("\033[94m"),
|
||||
[WAPP_TERM_COLOUR_FG_BR_CYAN] = wapp_str8_lit_ro_initialiser_list("\033[96m"),
|
||||
[WAPP_TERM_COLOUR_FG_BR_MAGENTA] = wapp_str8_lit_ro_initialiser_list("\033[95m"),
|
||||
[WAPP_TERM_COLOUR_FG_BR_YELLOW] = wapp_str8_lit_ro_initialiser_list("\033[93m"),
|
||||
[WAPP_TERM_COLOUR_FG_BR_WHITE] = wapp_str8_lit_ro_initialiser_list("\033[97m"),
|
||||
[WAPP_TERM_COLOUR_CLEAR] = wapp_str8_lit_ro_initialiser_list("\033[0m"),
|
||||
};
|
||||
|
||||
void print_coloured_text(Str8RO *text, TerminalColour colour) {
|
||||
printf(WAPP_STR8_SPEC WAPP_STR8_SPEC, wapp_str8_varg(colours[colour]), wapp_str8_varg((*text)));
|
||||
}
|
||||
|
||||
#endif // !WAPP_PLATFORM_POSIX
|
||||
18
wapp/core/os/shell/termcolour/termcolour.c
Normal file
18
wapp/core/os/shell/termcolour/termcolour.c
Normal file
@@ -0,0 +1,18 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "termcolour.h"
|
||||
#include "terminal_colours.h"
|
||||
#include "../../../../primitives/strings/str8/str8.h"
|
||||
|
||||
void wapp_shell_termcolour_print_text(Str8RO *text, TerminalColour colour) {
|
||||
if (colour < WAPP_TERM_COLOUR_FG_BLACK || colour > WAPP_TERM_COLOUR_FG_BR_WHITE) {
|
||||
return;
|
||||
}
|
||||
|
||||
print_coloured_text(text, colour);
|
||||
}
|
||||
|
||||
void wapp_shell_termcolour_clear_colour(void) {
|
||||
Str8RO empty = wapp_str8_lit_ro("");
|
||||
print_coloured_text(&empty, WAPP_TERM_COLOUR_CLEAR);
|
||||
}
|
||||
24
wapp/core/os/shell/termcolour/termcolour.h
Normal file
24
wapp/core/os/shell/termcolour/termcolour.h
Normal file
@@ -0,0 +1,24 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef TERM_COLOUR_H
|
||||
#define TERM_COLOUR_H
|
||||
|
||||
#include "terminal_colours.h"
|
||||
#include "../../../../common/aliases/aliases.h"
|
||||
#include "../../../../common/platform/platform.h"
|
||||
#include "../../../../primitives/strings/str8/str8.h"
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
void wapp_shell_termcolour_print_text(Str8RO *text, TerminalColour colour);
|
||||
void wapp_shell_termcolour_clear_colour(void);
|
||||
|
||||
external void print_coloured_text(Str8RO *text, TerminalColour colour);
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
#endif // !TERM_COLOUR_H
|
||||
39
wapp/core/os/shell/termcolour/terminal_colours.h
Normal file
39
wapp/core/os/shell/termcolour/terminal_colours.h
Normal file
@@ -0,0 +1,39 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef TERMINAL_COLOURS_H
|
||||
#define TERMINAL_COLOURS_H
|
||||
|
||||
#include "../../../../common/aliases/aliases.h"
|
||||
#include "../../../../common/platform/platform.h"
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
typedef enum {
|
||||
WAPP_TERM_COLOUR_FG_BLACK,
|
||||
WAPP_TERM_COLOUR_FG_RED,
|
||||
WAPP_TERM_COLOUR_FG_GREEN,
|
||||
WAPP_TERM_COLOUR_FG_BLUE,
|
||||
WAPP_TERM_COLOUR_FG_CYAN,
|
||||
WAPP_TERM_COLOUR_FG_MAGENTA,
|
||||
WAPP_TERM_COLOUR_FG_YELLOW,
|
||||
WAPP_TERM_COLOUR_FG_WHITE,
|
||||
WAPP_TERM_COLOUR_FG_BR_BLACK,
|
||||
WAPP_TERM_COLOUR_FG_BR_RED,
|
||||
WAPP_TERM_COLOUR_FG_BR_GREEN,
|
||||
WAPP_TERM_COLOUR_FG_BR_BLUE,
|
||||
WAPP_TERM_COLOUR_FG_BR_CYAN,
|
||||
WAPP_TERM_COLOUR_FG_BR_MAGENTA,
|
||||
WAPP_TERM_COLOUR_FG_BR_YELLOW,
|
||||
WAPP_TERM_COLOUR_FG_BR_WHITE,
|
||||
WAPP_TERM_COLOUR_CLEAR,
|
||||
|
||||
COUNT_TERM_COLOUR,
|
||||
} TerminalColour;
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
#endif // !TERMINAL_COLOURS_H
|
||||
73
wapp/core/os/shell/termcolour/win/termcolour_win.c
Normal file
73
wapp/core/os/shell/termcolour/win/termcolour_win.c
Normal file
@@ -0,0 +1,73 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "../../../../../common/aliases/aliases.h"
|
||||
#include "../../../../../common/platform/platform.h"
|
||||
#include "../../../../../primitives/strings/str8/str8.h"
|
||||
|
||||
#ifdef WAPP_PLATFORM_WINDOWS
|
||||
|
||||
#include "../terminal_colours.h"
|
||||
#include "../../../../../common/misc/misc_utils.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
|
||||
typedef struct termcolour_data TermcolourData;
|
||||
struct termcolour_data {
|
||||
HANDLE handle;
|
||||
WORD default_colour;
|
||||
WORD current_colour;
|
||||
|
||||
wapp_misc_utils_padding_size(sizeof(HANDLE) + sizeof(WORD) + sizeof(WORD));
|
||||
};
|
||||
|
||||
internal void init_data(TermcolourData *data);
|
||||
|
||||
internal WORD colours[COUNT_TERM_COLOUR] = {
|
||||
[WAPP_TERM_COLOUR_FG_BLACK] = 0,
|
||||
[WAPP_TERM_COLOUR_FG_RED] = FOREGROUND_RED,
|
||||
[WAPP_TERM_COLOUR_FG_GREEN] = FOREGROUND_GREEN,
|
||||
[WAPP_TERM_COLOUR_FG_BLUE] = FOREGROUND_BLUE,
|
||||
[WAPP_TERM_COLOUR_FG_CYAN] = FOREGROUND_GREEN | FOREGROUND_BLUE,
|
||||
[WAPP_TERM_COLOUR_FG_MAGENTA] = FOREGROUND_RED | FOREGROUND_BLUE,
|
||||
[WAPP_TERM_COLOUR_FG_YELLOW] = FOREGROUND_RED | FOREGROUND_GREEN,
|
||||
[WAPP_TERM_COLOUR_FG_WHITE] = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
|
||||
[WAPP_TERM_COLOUR_FG_BR_BLACK] = FOREGROUND_INTENSITY,
|
||||
[WAPP_TERM_COLOUR_FG_BR_RED] = FOREGROUND_RED | FOREGROUND_INTENSITY,
|
||||
[WAPP_TERM_COLOUR_FG_BR_GREEN] = FOREGROUND_GREEN | FOREGROUND_INTENSITY,
|
||||
[WAPP_TERM_COLOUR_FG_BR_BLUE] = FOREGROUND_BLUE | FOREGROUND_INTENSITY,
|
||||
[WAPP_TERM_COLOUR_FG_BR_CYAN] = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
|
||||
[WAPP_TERM_COLOUR_FG_BR_MAGENTA] = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
|
||||
[WAPP_TERM_COLOUR_FG_BR_YELLOW] = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
|
||||
[WAPP_TERM_COLOUR_FG_BR_WHITE] = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
|
||||
};
|
||||
|
||||
void print_coloured_text(Str8RO *text, TerminalColour colour) {
|
||||
persistent TermcolourData data = {0};
|
||||
if (data.handle == 0) {
|
||||
init_data(&data);
|
||||
}
|
||||
|
||||
if (colour == WAPP_TERM_COLOUR_CLEAR) {
|
||||
data.current_colour = data.default_colour;
|
||||
} else {
|
||||
data.current_colour = colours[colour];
|
||||
}
|
||||
|
||||
SetConsoleTextAttribute(data.handle, data.current_colour);
|
||||
printf(WAPP_STR8_SPEC, wapp_str8_varg((*text)));
|
||||
}
|
||||
|
||||
internal void init_data(TermcolourData *data) {
|
||||
// create handle
|
||||
data->handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
// get console colour information
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
GetConsoleScreenBufferInfo(data->handle, &csbi);
|
||||
data->default_colour = csbi.wAttributes;
|
||||
data->current_colour = data->default_colour;
|
||||
}
|
||||
|
||||
#endif // !WAPP_PLATFORM_WINDOWS
|
||||
26
wapp/core/os/shell/utils/shell_utils.h
Normal file
26
wapp/core/os/shell/utils/shell_utils.h
Normal file
@@ -0,0 +1,26 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef SHELL_UTILS_H
|
||||
#define SHELL_UTILS_H
|
||||
|
||||
#include "../../../../common/aliases/aliases.h"
|
||||
#include "../../../../common/platform/platform.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
#ifdef WAPP_PLATFORM_WINDOWS
|
||||
#define wapp_shell_utils_popen _popen
|
||||
#define wapp_shell_utils_pclose _pclose
|
||||
#else
|
||||
#define wapp_shell_utils_popen popen
|
||||
#define wapp_shell_utils_pclose pclose
|
||||
#endif /* ifdef WAPP_PLATFORM_WINDOWS */
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
#endif // !SHELL_UTILS_H
|
||||
Reference in New Issue
Block a user