Search squid archive

Re: Need help to build my own external help

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

 



>> I reduced my program to that:
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <string.h>
>> #define MAX_INPUT 8192
>> int main(int argc, char **argv)
>> {
>>    char request [MAX_INPUT];
>>    while (fgets(request, MAX_INPUT , stdin) != NULL)
>>    {
>>        printf ("OK\n");
>>    }
>>    return 0;
>> }
>>
>> But, I still get the same problem,
>
> I jump in the middle of the conversation but,
> the return will constantly end the helper...
> It is supposed to loop "forever".
> I used to use this:
>
> #define INPUTSIZE 8192 char input[INPUTSIZE]; while (fgets(input, sizeof(input), stdin)) { if ((cp=strchr(input, '\n')) == NULL) { fprintf(stderr, "filter: input too big: %s\n", input); } else { *cp = '\0'; } ... fflush(stderr); fflush(stdout); }
>
> JD

Actually, it should loop forever because the return is outside the
while (fgets(...) != NULL) and fgets is supposed to not return NULL
unless some error occurs.

Also refer to the source code of ext_session_acl which has a return 0
at the end.


-- 
Mohamed Amine Kadimi

Tél     : +212 (0) 675 72 36 45



[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux