On 21 Aug 2006 at 18:13, Frank Heckenbach wrote:
Prof. A Olowofoyeku (The African Chief) wrote:
[...]
This was just an experiment to see if I could add somefunctionality to the router firmware that other routers didn't have, but which I have seen in Smoothwall. In the end all that was required was two small procedures. I would have probably wanted to add more programs
- but the router has only limited free space in the flash memory,
and so it is not feasible if all programs would be 100kb or more in size.
With full dynamic linking (i.e., if you move the .o files of all non-RTS units into a .so library as well), the individual programs should be smaller, but of course, the one-time space requirement for this .so and libgpc.so would still be a few 100 KB. How much free space does it have, BTW?
There are two versions of the router - one has 1mb free on the flash, and another has about 200kb free. The files stored on flash are in a squashfs 2.1 filesystem, so it just about fitted on the second version of the router.
However, see below.
I have just had a look through cgi.pas and found "query_string". A search through the web indicates that this might be all I need for my shell script :)
Basically yes, at least for GET requests, though you might have to do some parsing which isn't always nice to do in shell scripts -- especially if you need multiple variables or quoted characters (though most printable ASCII characters are usually not quoted).
[...]
Yes, I came across that problem. I eventually solved it by doing the parsing of the cgi GET request in C (called from the shell script with "eval").
The script you have included is very helpful, thanks. I am sure I can do other things with it.
Finally, I wrote the whole program in C (compiled to 9kb). For me, this change of language was a retrograde (but necessary) step, and what took me 15 minutes to accomplish in Pascal took hours to do in C (obviously my C is rubbish). This leads to my next few questions:
1. Is it possible to have reduced functionality versions of libgpc (perhaps produced with a switch when building the compiler?)? If so, is it possible to choose which features shall be built into it? (e.g., via a simple text configuration file, of the kind you have when building the linux kernel, or busybox, etc.). What I mean is something like (please note, this is off the top of my head, and is not properly thought through - it may even be impossible or the necessary features may not be in libgpc at all, but rather in the compiler):
# enable support for pascal strings STRINGS=y
# Pascal file I/O FILES=y
# Pascal objects OOP=y
etc., etc.
2. What things can be done in GPC without libgpc - for example, if one produced an include file of libc exports and doesn't use units or Pascal strings or objects or file I/O at all?
3. This follows from #2 - how can one write a different libgpc? Is there a special thing that has to be done to make it work (i.e., how is it different from any bog-standard .a or .so file?).
4. Would there be any mileage in producing a libc standard unit?
Thanks,
Best regards, The Chief --------- Prof. Abimbola Olowofoyeku (The African Chief) Web: http://www.greatchief.plus.com/