[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: could we use c replace perl in cgi program?



eric writes:

> > 1) If you want to install that library, you ought to do it manually
> >    as the way the Makefile is, it will not work correctly.
> 
> highly apprecaite you point out how to "as the way the Makefile 
> is"(modify Makefile in cgilib-0.5? by adding or deleting or modifying 
> anything?)?

   To my understanding, cgilib-0.5's Makefile "install" operation
(i.e.  "make install") does not install the library in a convenient
location (such as /usr/lib), but rather places the example CGI
executable "cgi-test" in /usr/lib/cgi-bin.

install: cgitest
	install -m 755 cgitest /usr/lib/cgi-bin

   My point is that you should just copy the generated library
manually and place it into /usr/lib.

> some in debian seem also have a package do about using c replace perl

> this is my  c program try, to achieve get data out from html's submit 
> and form, if it is not a dream

It's certainly possible but you do not yet seem to understand the
framework you are working with.

> 
>  > #include <stdio.h>
>  >
>  > int main()
>  > {
>  >           extern char name[][];
>  >           extern char value[][];
>  >
>  >
>  >           printf("Content-type: text/html\n\n");
>  >           printf("<html><body>\n");
>  >           printf("the price fo ", name[1], " equal ", value[1], "\n");
>  >           printf("</body></html>");
>  > }

> Well, sure, where do you expect name and value to actually be defined?
> (I don't think 'extern' is allowed to modify local variables in any
> case.)  You also might look for C CGI libraries if this would make you
> happy; there seems to be a libcgicg1-dev package in unstable, which
> appears to provide the right functionality.

Name and value are not bound to anything; they're just pointer
pointers that have yet to be assigned.

For CGI-BIN, parameters are passed to your program via environment
variables. For a reference, you may want to look here:

<http://hoohoo.ncsa.uiuc.edu/cgi/env.html>

The nice thing about the CGI libraries is they package up the
submitted parameters and place them nicely in variables, such as the
"name" and "value" variables mentioned above. If you do not want to
use one of theirs, you shall have to construct you own.

Elizabeth



Reply to: