raspi-config is a bash script, so you can read it with a text editor.
The file can be found here /usr/bin/raspi-config
But there is no need to do a C program, you could simply use the bash script and tweak it after your needs.
I have is sshd.service but I cannot find the target (its only an alias)
The proper term is a symlink ;) They are used by systemd to enable services (which means you can customize all that without ever running the system, by creating the correct symlinks in the root fs); the various directories contain symlinks to the service files for that general target (...
Driving a 3.3V pin with a 12V signal will require a level shifter anyway, and inverting level shifters have essentially the same complexity as non-inverting ones.
For instance, here's an example using an optocoupler:
simulate this circuit – Schematic created using CircuitLab
The advantage of an optocoupler is that you don't have to have the same ...
EDIT: I have missed the pulldown resistor in my illustration for the accessories to ground. Don't forget that or you will get a floating value when the car is on!
I know this is old but in the off chance it helps someone, I thought I might share my solution. I'm pretty new to all of this so please, if I am doing anything stupid, let me know.
A small, ...