⚠️ Warning: This is a draft ⚠️
This means it might contain formatting issues, incorrect code, conceptual problems, or other severe issues.
If you want to help to improve and eventually enable this page, please fork RosettaGit's repository and open a merge request on GitHub.
{{implementation|C0H}} c0h is the implementation for the [[C0H]] language on Unix machines; porting to Windows and other platforms should be fairly easy.
In fact c0h is a simple shell script that efficiently uses the already available [[C]] compiler named cc:
#!/bin/bash
FILENAME=$1
FILESIZE=$(stat -f%z "$FILENAME")
if [ $FILESIZE -eq 0 ]
then
cat << EOF > $FILENAME
#include <stdio.h>
int main(char args[]) {printf("Goodbye, World!\\n");}
EOF
fi
cc $FILENAME
if [ $FILESIZE -eq 0 ]
then
echo -n > $FILENAME
fi
A typical test session would look like:
$ echo -n >c0.c
$ ./c0h c0.c
$ ./a.out
Goodbye, World!