#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"); } };