[cs631apue] Final template code question

Rob Hoffmann rhoffman at stevens.edu
Wed Nov 9 22:44:41 EST 2011

I did notice __sws_debug, but in the sample it is used in swslib.c. From 
what I understand I need to be able to read it in main.c in order to 
limit the connections that are accepted in mainloop. So for example, in 
main.c I have:

if (__sws_debug == 1)
                 max_connections = 1;
                 max_connections = 10;

But gcc will error with
main.c:62:6: error: â__sws_debugâ undeclared (first use in this function)

Since __sws_debug is declared in the source file.

Sorry if I'm missing something really obvious.


On 11/9/2011 10:13 PM, Jan Schaumann wrote:
> Rob Hoffmann<rhoffman at stevens.edu>  wrote:
>> Would it be alright if I was to either pass the options to the mainloop
>> or make it a global variable, or move the sws globals from swslib.c to
>> the header file?
> The struct swsopts is passed to sws_init(), which can set "globals" in
> the "library" (as the sample implementation does).
> The example provided then makes use of the __sws_debug variable to
> identify whether or not it's running in debug mode or not.
> So unless I messed up the example (which is of course entirely
> possible), you should be able to pass information via sws_init
> sufficiently.
> -Jan
> _______________________________________________
> cs631apue mailing list
> cs631apue at lists.stevens.edu
> https://lists.stevens.edu/cgi-bin/mailman/listinfo/cs631apue

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20111109/d4661643/attachment.html>

More information about the cs631apue mailing list