UGHHHH...  I'm glad you copied my original message text in your reply. I'm
definitely multi-tasking WAY too much today.

That Delphi/Kylix code is a lot more elegant than I originally noticed. And
far better than the corresponding GetCGIEnvVar method in ConCGI.

That BufSize and corresponding Buffer are just a first attempt to provide a
reasonably-sized scratch space for any data the OS would return. If the OS
signals that the Env var size is larger than the buffer provided, the
function allocates the correct size and reissues the request. It's PERFECT,
and will handle all your needs for ALL sizes (provided security is not a
concern <g>; Env Vars are a large security concern...), ... if this code can
be made to run under FreePascal. — which, from the looks of it, and my guess
of how FreePascal would attempt to implement things... should run
immediately...   This appears to be the way that FreePascal should have
implemented their Windows version of getenv().

It also wisely uses stack space for its temp vars, instead of the much
slower heap that GetCGIEnvVar uses; or directly loads the longer responses
into the result string.

And the Linux version of course just returns the whole thing...


To my knowledge the other functions I mentioned “call the Os for you” also,
they just cap the string length.

I don't work with FreePascal at all, so I wouldn't recognize those getenv...
functions from there. They probably just take the Linux "API"/ OS functions
and kept the same names for library code...

Good Luck with your project, but if I were you I'd be sure to investigate if
there weren't already existing good projects to work with and/or contribute
to.  On the Delphi / Kylix side of things, there are a number, including
multiple systems of code that were sold with the professional and higher
versions of those products.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to