[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

Web programming in C lang with TCC

lovecreatesbeauty@gmail.c0m

6/16/2011 9:32:00 AM

$ cat /usr/lib/cgi-bin/ex1.c
#!/usr/local/bin/tcc -run

#include <tcclib.h>

int main(void)
{
printf("Content-type: text/html\r\n\r\n");
printf("Hello <a href=\"http://bellar...\">TCC</a> cgi
\n");

return 0;
}
$

Screenshot:
https://gknszq.bay.livefilestore.com/y1pb88_dv-BFgRHvX54YUSaOhLLDXSfqxErZ2vYx4wKOYcb-nZMOotjMFun53R9S4zttdy63hP6NGMFXem425vYBBi4JhJJdC5D/tcc_cgi....
87 Answers

Mark Bluemel

6/16/2011 9:54:00 AM

0

On 06/16/2011 10:31 AM, lovecreatesbeauty wrote:
> $ cat /usr/lib/cgi-bin/ex1.c
> #!/usr/local/bin/tcc -run
>
> #include<tcclib.h>
>
> int main(void)
> {
> printf("Content-type: text/html\r\n\r\n");
> printf("Hello<a href=\"http://bellar...\">TCC</a> cgi
> \n");
>
> return 0;
> }
> $
>
> Screenshot:
> https://gknszq.bay.livefilestore.com/y1pb88_dv-BFgRHvX54YUSaOhLLDXSfqxErZ2vYx4wKOYcb-nZMOotjMFun53R9S4zttdy63hP6NGMFXem425vYBBi4JhJJdC5D/tcc_cgi....

Did you have a question or a point to make?

lovecreatesbeauty@gmail.c0m

6/16/2011 10:10:00 AM

0

On Jun 16, 5:54 pm, Mark Bluemel <mark_blue...@pobox.com> wrote:
> On 06/16/2011 10:31 AM, lovecreatesbeauty wrote:
>
>
>
>
>
>
>
>
>
> > $ cat /usr/lib/cgi-bin/ex1.c
> > #!/usr/local/bin/tcc -run
>
> > #include<tcclib.h>
>
> > int main(void)
> > {
> >          printf("Content-type: text/html\r\n\r\n");
> >          printf("Hello<a href=\"http://bellar...\">TCC</a>  cgi
> > \n");
>
> >          return 0;
> > }
> > $
>
> > Screenshot:
> >https://gknszq.bay.livefilestore.com/y1pb88_dv-BFgRHvX54YUS......
>
> Did you have a question or a point to make?

Thanks for posting.

I mean I posted this one "The end of C-like script languages - C
script with TCC" some days ago.

People seems don't believe the C can be directly used in web
programming :)

I wish C (with TCC) eat up PHP, Perl, ..

io_x

6/16/2011 2:57:00 PM

0


"lovecreatesbeauty" <lovecreatesbeauty@gmail.com> ha scritto nel messaggio
news:3617d215-8302-4044-bed7-0e4d50038203@r35g2000prj.googlegroups.com...
>$ cat /usr/lib/cgi-bin/ex1.c
> #!/usr/local/bin/tcc -run
>
> #include <tcclib.h>
>
> int main(void)
> {
> printf("Content-type: text/html\r\n\r\n");

i think in some pc, in some compiler, in some OS: "\n\n" could be sufficient
but if above there is "\r\n" than below there is need of "\r\n" too;
[and this is not here]

i don't know why you have to #include "tcclib.h"
printf should be the stdio printf, that print to stdout

> printf("Hello <a href=\"http://bellar...\">TCC</a> cgi
> \n");
>
> return 0;
> }

so for me it should be the file as
--------------
// file name page.c
#include <stdio.h>

int main(void)
{printf("Content-type: text/html \n\n");
printf("Hello <a href=\"http://bellar...\">TCC</a> cgi\n");
return 0;
}
--------------

if one server has to open the page a.htm
and if "a.htm" is looking up to "page.exe"
the server can execute that program
write the remain header send header
with stdout-output to the client

> Screenshot:
> https://gknszq.bay.livefilestore.com/y1pb88_dv-BFgRHvX54YUSaOhLLDXSfqxErZ2vYx4wKOYcb-nZMOotjMFun53R9S4zttdy63hP6NGMFXem425vYBBi4JhJJdC5D/tcc_cgi....



Angel

6/16/2011 3:15:00 PM

0

On 2011-06-16, lovecreatesbeauty <lovecreatesbeauty@gmail.com> wrote:
>
> People seems don't believe the C can be directly used in web
> programming :)

CGI programs written in C have been around longer than PHP and Perl
have, I think.


--
"C provides a programmer with more than enough rope to hang himself.
C++ provides a firing squad, blindfold and last cigarette."
- seen in comp.lang.c

Tom St Denis

6/16/2011 3:43:00 PM

0

On Jun 16, 10:56 am, "io_x" <a...@b.c.invalid> wrote:
> "lovecreatesbeauty" <lovecreatesbea...@gmail.com> ha scritto nel messaggionews:3617d215-8302-4044-bed7-0e4d50038203@r35g2000prj.googlegroups.com...
>
> >$ cat /usr/lib/cgi-bin/ex1.c
> > #!/usr/local/bin/tcc -run
>
> > #include <tcclib.h>
>
> > int main(void)
> > {
> >        printf("Content-type: text/html\r\n\r\n");
>
> i think in some pc, in some compiler, in some OS: "\n\n" could be sufficient
> but if above there is "\r\n" than below there is need of "\r\n" too;
> [and this is not here]

Not only is this ridiculously OT, but in HTTP you must send \r\n\r\n
to indicate two blank lines REGARDLESS of your platform hosting or
consuming content.

> so for me it should be the file as
> --------------
> // file name page.c
> #include <stdio.h>
>
> int main(void)
> {printf("Content-type: text/html \n\n");
>  printf("Hello <a href=\"http://bellar...\">TCC</a> cgi\n");
>  return 0;}

Except this won't work, and you'd know that if you tested it (any half
decent web server would reject the CGI output and issue an error).

Tom

Keith Thompson

6/16/2011 4:09:00 PM

0

lovecreatesbeauty <lovecreatesbeauty@gmail.com> writes:
[...]
> I mean I posted this one "The end of C-like script languages - C
> script with TCC" some days ago.
>
> People seems don't believe the C can be directly used in web
> programming :)

I don't think anyone has ever suggested that it's not possible.
And for generating static content, as your program does, it probably
works as well as any other language -- though not as well as just
creating an html file in the right place.

For other purpose, scripting languages offer much easier string
handling, which is a considerable advantage in this context.

> I wish C (with TCC) eat up PHP, Perl, ..

By all means, wish away.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.ne...
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

lovecreatesbeauty@gmail.c0m

6/16/2011 5:32:00 PM

0

On Jun 17, 12:08 am, Keith Thompson <ks...@mib.org> wrote:
>
> I don't think anyone has ever suggested that it's not possible.
> And for generating static content, as your program does, it probably
> works as well as any other language -- though not as well as just
> creating an html file in the right place.

Thank you.

I tried some more examples with TCC just now tonight (01:25 dark and
silent morning like the night here:).

You're right. TCC presents static pages easily but lacks of session
management. And PHP features like $_GET['x'], $_POST['x'] are missing
from TCC currently. Maybe someone will contribute on this area for
TCC. Can this guy be me:)

> For other purpose, scripting languages offer much easier string
> handling, which is a considerable advantage in this context.

TCC seems can use the whole C library as well as the stdio.h and
string.h. I think the string operation function are not a problem for
TCC to succeed on web.

lovecreatesbeauty@gmail.c0m

6/16/2011 5:36:00 PM

0

On Jun 16, 11:15 pm, Angel <angel+n...@spamcop.net> wrote:
> On 2011-06-16, lovecreatesbeauty <lovecreatesbea...@gmail.com> wrote:
> CGI programs written in C have been around longer than PHP and Perl
> have, I think.

With TCC, the request points directly to the .c source file
http://192.168.122.199/c...
not something like
http://192.168.122.199/cgi...
or
http://192.168.122.199/cg...

I may be wrong.

lovecreatesbeauty@gmail.c0m

6/16/2011 5:46:00 PM

0

On Jun 17, 12:08 am, Keith Thompson <ks...@mib.org> wrote:
>
> For other purpose, scripting languages offer much easier string
> handling, which is a considerable advantage in this context.
>

I think by now C scripting with TCC can at least kick Perl out of
stage

>> I wish C (with TCC) eat up PHP, Perl, ..

> By all means, wish away.

What's your opinion on TCC's ability of making C a power script tool?
C is great and should be used everywhere.

lovecreatesbeauty@gmail.c0m

6/16/2011 5:54:00 PM

0

On Jun 17, 1:46 am, lovecreatesbeauty <lovecreatesbea...@gmail.com>
wrote:
> On Jun 17, 12:08 am, Keith Thompson <ks...@mib.org> wrote:
>
> > For other purpose, scripting languages offer much easier string
> > handling, which is a considerable advantage in this context.
>

No more weird languages like Perl, Pythod, Ruby, PHP, ..blah..