Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: tcc scripts, automating tasks and having a blast< Next Oldest | Next Newest >
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Oct. 28 2004,00:44 QUOTE

I just learned that you can write shell scripts in C using the tcc C compiler included in dsl!  To compile a normal program, you would use tcc test.c to compile the following file

Code Sample

/* test.c */
#include <tcclib.h>

int main()
{
    printf("Hello, DSL\n");
    return 0;
}


To run it as a shell script, create the following as a file, save it as test, change it's mode with chmod 777 test, then run it by typing test.

Code Sample

#!/usr/bin/tcc -run
#include <tcclib.h>

int main()
{
    printf("Hello, DSL\n");
    return 0;
}


I see that they have an article on SlashDot about tcc and tccboot, which compiles the kernel at boot time!  Looks like tcc is moving up in the world of being small.
Back to top
Profile PM 
Dafydd Cealleigh Offline





Group: Members
Posts: 11
Joined: Oct. 2004
Posted: Oct. 28 2004,02:35 QUOTE

I thought 777 set the directory bit.
Back to top
Profile PM 
AwPhuch Offline





Group: Members
Posts: 1404
Joined: April 2004
Posted: Oct. 28 2004,04:01 QUOTE

no it can be used to set a file to read/write/execute

Brian
AwPhuch


--------------
http://www.frappr.com/dsl <-- Where do you use DSL?
http://www.smoothwall.org <-- Ultimate firewall for the world!
http://boinc.mundayweb.com/one/stats.php/userID:6107 <--My BOINC stats!
./S99LinuxRevolution start
Back to top
Profile PM WEB 
SaidinUnleashed Offline





Group: Members
Posts: 1428
Joined: Mar. 2004
Posted: Oct. 28 2004,04:14 QUOTE

cool. This might make it much easier to build Linux from scratch.

Might have to check it out during winter break.

-J.P.


--------------
They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, cause if you play it forwards, it installs Windows.

Unleash the power of the TILDE~~~
Back to top
Profile PM AOL MSN YIM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Oct. 28 2004,13:04 QUOTE

Dafydd Cealleigh, it does set that bit.  I'm a lazy programmer, I see I could have used chmod +x test as well.

EDIT:

wrong, it doesn't set the directory bit.  I read up and then remembered (you tend to do things by route after a while instead of thinking):

1 = execute
2 = write
4 = read

add the numbers for the mode you want.  You need three numbers, one for user, the second for group, and the third for other.  So my bits were set for read, write, & execute for me, my group, and everyone.
Back to top
Profile PM 
8 replies since Oct. 28 2004,00:44 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: tcc scripts

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code