binfmtc - binfmt_misc C scripting interface

Introducing the binfmt_misc C scripting interface

"I love C". "I enjoy writing in C". "I don't feel well when I have passed a day without coding a line of C". "My conversation with my wife simply doesn't flow without the C language". "I want to write everything in C, even the everyday scripting, but due to the steps required for writing make files and other things, I tend to choose interpreted languages". A good news for the C programmers suffering from these symptoms. binfmtc is a hack to allow you to use the C language for cases where script languages such as perl and shell were the languages of choice.

Also included is a "real csh" as an example, allowing you to use the C language style for executing everyday sysadmin work. Please experience the real C shell, which has a slightly different tint to the original C shell we've been used to for more than 10 years.

Screenshots

C assembly C++ real csh

Examples of execution in C, assembly, and C++. The last entry is the one for real csh.

Usage

Simply add a magic keyword /*BINFMTC: compile-time options and add execution permission to the C-script. Every time you invoke the script, the compiler will compile and execute the program for you.

How to install

For sid add the following line to /etc/apt/sources.list and do apt-get update; apt-get install binfmtc.

deb http://www.netfort.gr.jp/~dancer/tmp/20050523 ./
    

Mechanics behind it

By registering magic through Linux binfmt_misc, binfmtc-interpreter will be invoked every time a C script is invoked. binfmtc-interpreter will parse the specified script file, and will invoke gcc with the required options, and compile to a temporary binary, and invoke the binary.

Future plans

Do you actually find it, ... useful?

References


Junichi Uekawa

$Id: binfmtc.html.en,v 1.11 2006/04/16 03:03:16 dancer Exp $