scripting in pure C

Forum rules
Share your brain ;)
User avatar
DebianJoe
Frame Buffer
Posts: 1915
Joined: Mon Jul 01, 2013 5:41 am
Location: emacs.d

scripting in pure C

Unread post by DebianJoe » Tue Nov 25, 2014 10:45 am

Cool trick if you're not that into shell scripting and prefer C.

Grab a copy of TCC here, because it doesn't create a ton of bytecode overhead. It's fast, and if you're that into C, you want it anyhow.

Write a program in C to do what you like, but then above all the includes, add a shebang line like this:

Code: Select all

#!/usr/local/bin/tcc -run
Chmod your file to 755 (or +x, assuming that's how you roll), and then just run it as a script.
2014-11-25-033736_1024x768_scrot.png
|>>BBQ Roaster, Alpha Branch<< | >> clinky << | >> X11 must die << |
Thanks BASIC

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: scripting in pure C

Unread post by machinebacon » Tue Nov 25, 2014 2:59 pm

oh wow, that's really cool :) Thanks for the share!
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: scripting in pure C

Unread post by GekkoP » Tue Nov 25, 2014 3:32 pm

Very cool, my kind of stuff. Thank you, Joe.

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: scripting in pure C

Unread post by wuxmedia » Wed Nov 26, 2014 12:49 pm

Thats probably the only way i'd get into writing C
gcc and make and all that stuff feels a bit of a drag, compared to knocking up a * script
Nice share.
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
Dr_Chroot
Alfalfa
Posts: 1100
Joined: Mon Jun 09, 2014 9:49 pm
Location: among the sagebrush
Contact:

Re: scripting in pure C

Unread post by Dr_Chroot » Wed Nov 26, 2014 10:50 pm

^ This. Couldn't have said it better myself :D Thanks Joe.
Fight internet censorship.
EFF | Tor Project | Bitcoin

"There have been times throughout American history where what is right is not the same as what is legal. Sometimes to do the right thing you have to break the law." - Edward Snowden

Post Reply