diff --git a/pc-outro.c b/pc-outro.c new file mode 100644 index 0000000..b8f7c1f --- /dev/null +++ b/pc-outro.c @@ -0,0 +1,34 @@ +#include +#include "portaudio.h" + + +void shutdown(int os); + +void main (void){ + int os; + + #ifdef _WIN32 + os = 1; + #elif TARGET_OS_MAC + os = 2 + #elif __linux__ + os = 3; + #elif BSD + os = 4; + #else + os = 0; + #endif + + printf("%d", os); + +}; + +void shutdown(int os){ + switch(os){ + case 3: + // TODO: check init system; https://unix.stackexchange.com/questions/18209/detect-init-system-using-the-shell + system("shutdown -P now"); + default: + printf("Error: Could not determine OS"); + } +};