init file + basic os detection

This commit is contained in:
array-in-a-matrix 2022-09-16 16:23:59 -04:00
parent f801a68eb1
commit cf5ed43812

34
pc-outro.c Normal file
View file

@ -0,0 +1,34 @@
#include <stdio.h>
#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");
}
};