Initial commit

Start a new clean history from here.
This commit is contained in:
Romain Vimont
2017-12-12 15:12:07 +01:00
commit 54d9148a36
29 changed files with 1537 additions and 0 deletions

45
app/src/command.h Normal file
View File

@@ -0,0 +1,45 @@
#ifndef COMMAND_H
#define COMMAND_H
#include <inttypes.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_platform.h>
// <https://stackoverflow.com/a/44383330/1987178>
#ifdef _WIN32
# ifdef _WIN64
# define PRIsizet PRIu64
# define PRIexitcode "lu"
# else
# define PRIsizet PRIu32
# define PRIexitcode "u"
# endif
#else
# define PRIsizet "zu"
# define PRIexitcode "d"
#endif
#ifdef __WINDOWS__
# include <windows.h>
# define PROCESS_NONE NULL
typedef HANDLE process_t;
typedef DWORD exit_code_t;
#else
# include <sys/types.h>
# define PROCESS_NONE -1
typedef pid_t process_t;
typedef int exit_code_t;
#endif
# define NO_EXIT_CODE -1
process_t cmd_execute(const char *path, const char *const argv[]);
SDL_bool cmd_terminate(process_t pid);
SDL_bool cmd_simple_wait(process_t pid, exit_code_t *exit_code);
process_t adb_execute(const char *serial, const char *const adb_cmd[], int len);
process_t adb_forward(const char *serial, uint16_t local_port, const char *device_socket_name);
process_t adb_reverse(const char *serial, const char *device_socket_name, uint16_t local_port);
process_t adb_reverse_remove(const char *serial, const char *device_socket_name);
process_t adb_push(const char *serial, const char *local, const char *remote);
#endif