descriptionRun C code from sources
ownerjrische@laposte.net
last changeSat, 22 Jan 2022 22:47:16 +0000 (22 23:47 +0100)
content tags
add:
README.md

c2run

Fork of Jason A. Donenfeld's cscript

c2run executes C code from stdin using any variety of compiler arguments. It can be used from the command line:

$ echo 'main(){puts("hello world");}' | c2run

Or it can be used at the top of scripts:

 #!/usr/bin/c2run
 main(){puts("hello world");}

One might even register .c as an executable file type:

# echo ':cfile:E::c::/usr/bin/c2run:' > /proc/sys/fs/binfmt_misc/register
$ echo 'main(){puts("hello world");}' > a.c
$ chmod +x a.c
$ ./a.c

It respects the CC environment variable, and does not create any temporary dentries that need to be cleaned up ever.

Building

$ make
$ sudo make install PREFIX=/usr

License

This project is released under the GPLv2.

shortlog
2022-01-22 Julien RischeUpdate clang formatmaster
2022-01-22 Julien RischeMove code in dedicated functions
2022-01-22 Julien RischeFork from cscript
2021-06-15 Jason A. Donenfeldscript: use memfd_create instead of O_TMPFILE
2018-11-27 Jason A. Donenfeldexample: avoid multi-dimensional array
2018-07-04 Jason A. DonenfeldInitial commit
heads
2 years ago master