John Doe escreveu:
>> anyway, i would love to see something similar in C that could be compiled
>> and run with less memory than perl requires .... unfortunelly i cant code even a
>> 'hello world' in C !!! But i'll try that ..... shouldnt be too difficult.
>>
>
> Here's a basic C example:
>
> #include <stdio.h>
> #include <time.h>
>
> #define INPUTSIZE 256
>
> int main(int argc, char *argv[]) {
>
> char input[INPUTSIZE];
> char *cp;
> struct tm *local;
> time_t t;
> int year;
>
> while (fgets(input, sizeof(input), stdin)) {
> t = time(NULL);
> local = localtime(&t);
> year = local->tm_year + 1900;
> if (year < 2008) { printf("ERR\n"); } else { printf("OK\n"); }
> fflush(stdout);
> }
>
> }
>
> JD
>
> PS: I put a "small" INPUTSIZE and do not check for overflow...
>
>
Nice John, thanks very much for that !! Got it compiled and running,
no problem. Anyway, i found interesting that squid is reporting a high
average service time for this do-almost-nothing external ACL (from
cachemgr.cgi, external acl stats):
External ACL Statistics: verifica-ano
Cache size: 7
program: /etc/squid/verifica-ano
number running: 3 of 3
requests sent: 269
replies received: 269
queue length: 0
---> avg service time: 263.38 msec
from other machine, which uses squid_ldap_group as external acl, i have:
External ACL Statistics: ldap_group
Cache size: 965
program: /usr/bin/squid_ldap_group
number running: 5 of 5
requests sent: 6991
replies received: 6991
queue length: 0
---> avg service time: 8.26 msec
The second one, as i told, does LDAP connections and stuff, and is
running pretty fast.
i would expect the check-year to run faster, despite the fact it's
working just fine !!!
any hint on that ???
-- Atenciosamente / Sincerily, Leonardo Rodrigues Solutti Tecnologia http://www.solutti.com.br Minha armadilha de SPAM, N�O mandem email gertrudes_at_solutti.com.br My SPAMTRAP, do not email itReceived on Wed Sep 24 2008 - 15:40:26 MDT
This archive was generated by hypermail 2.2.0 : Wed Sep 24 2008 - 12:00:03 MDT