src/mn-slaved/client.c
static int
on_count(nolp_t *no, char *buf, int size)
{
    struct client *cl;
    char     *s;
    char      q[128];
    uint32_t  count;
    int       sz;

    cl = ((struct client *)no->private);
    if (!cl->running || !cl->session_id)
        return -1;
    if (!(s = memchr(buf, ' ', size))) {
        syslog(LOG_ERR, "error: invalid COUNT syntax");
        return -1;
    }

    *s = '\0';

    s++;
    count = (uint32_t)atoi(s);

    sz = sprintf(q, "UPDATE `nol_session` SET count_%s = %d WHERE id=%d",
                 nol_s_str_filter_name(buf, (s-1)-buf),
                 count,
                 cl->session_id);

    if (mysql_real_query(cl->mysql, q, sz) != 0) {
        syslog(LOG_ERR, "error: updating session statistics failed: %s",
                mysql_error(cl->mysql));
        return -1;
    }

    return 0;
}
/** 
 * COUNT reports the amount of matched URLs against
 * a filetype. Syntax:
 *
 * COUNT <filetype-name> <count>\n
 **/
COUNT reports the amount of matched URLs against
a filetype. Syntax.

COUNT  \n
COUNT reports the amount of matched URLs against a filetype . Syntax . COUNT \ n
static int
on_count(nolp_t *no, char *buf, int size)
{
    struct client *cl;
    char     *s;
    char      q[128];
    uint32_t  count;
    int       sz;
    cl = ((struct client *)no->private);
    if (!cl->running || !cl->session_id)
        return -1;
    if (!(s = memchr(buf, ' ', size))) {
        syslog(LOG_ERR, "error: invalid COUNT syntax");
        return -1;
    }
    *s = '\0';
    s++;
    count = (uint32_t)atoi(s);
    sz = sprintf(q, "UPDATE `nol_session` SET count_%s = %d WHERE id=%d",
                 nol_s_str_filter_name(buf, (s-1)-buf),
                 count,
                 cl->session_id);
    if (mysql_real_query(cl->mysql, q, sz) != 0) {
        syslog(LOG_ERR, "error: updating session statistics failed: %s",
                mysql_error(cl->mysql));
        return -1;
    }
    return 0;
}
static int on_count ( nolp_t * no , char * buf , int size ) { struct client * cl ; char * s ; char q [ 128 ] ; uint32_t count ; int sz ; cl = ( ( struct client * ) no -> private ) ; if ( ! cl -> running || ! cl -> session_id ) return -1 ; if ( ! ( s = memchr ( buf , ' ' , size ) ) ) { syslog ( LOG_ERR , " " ) ; return -1 ; } * s = ' \0 ' ; s ++ ; count = ( uint32_t ) atoi ( s ) ; sz = sprintf ( q , " " , nol_s_str_filter_name ( buf , ( s - 1 ) - buf ) , count , cl -> session_id ) ; if ( mysql_real_query ( cl -> mysql , q , sz ) != 0 ) { syslog ( LOG_ERR , " " , mysql_error ( cl -> mysql ) ) ; return -1 ; } return 0 ; }
COUNT reports the amount of matched URLs against
 a filetype.
COUNT reports the amount of matched URLs against a filetype .