Beispiel #1
0
GList *proc_net_tcp_open()
{
    proc_net_tcp_open_real();

    char linebuf[MAX_LINE_SIZE];
    int n;

    GList *list = NULL;         /* NULL */

    unsigned int size;
    char **elements = NULL;
    /* first line */
    n = w_readline(tcpfd, linebuf, MAX_LINE_SIZE);
    if (n <= 0 || (elements = proc_net_parse_line(linebuf, &size)) == NULL) {
        return list;
    }
    get_title_index(elements, size);
    proc_net_parse_line_free(elements, size);

    /* entries */
    while ((n = w_readline(tcpfd, linebuf, MAX_LINE_SIZE)) > 0) {
        elements = proc_net_parse_line(linebuf, &size);
        if (elements) {
            ProcNetTcpEntry *tcp = extract_entries(elements, size);
            list = g_list_append(list, tcp);
            proc_net_parse_line_free(elements, size);
        }
    }


    return list;
}
Beispiel #2
0
void set_titles(char *filename,const char *titles[],int numtitles)
{
    long fileindex=get_file_index(filename,1);
    long titleindex;
    char **errmsg=NULL;
    if(fileindex==(-1))
        return;
    
    int i;
    for(i=0;i<numtitles;i++)
    {
        titleindex=get_title_index(titles[i]);
        if(titleindex!=-1)
        {
            char *temp=sqlite3_mprintf("INSERT INTO booktitles (fileid,titleid) VALUES(%d,%d)",fileindex,titleindex);
            sqlite3_exec(madshelf_database,temp,NULL,NULL,NULL);
            sqlite3_free(temp);
            
        }
    }
}