Exemple #1
0
void my_system(){
	char choice;
	char com[MAX];
	char *com_parsed[MAX];
	char c;
	display();
	printf("please input one of the numbers above\n");
	c = getchar();
	getchar();
	while(1){
		if(c == '1'){
			printf("please input the command\n");
			gets(com);
			parse(com,com_parsed);
			//system("clear");
			scan_segment(com_parsed);	
		}	
		if(c == '2'){
			printf("please input the command\n");
			gets(com);
			parse(com,com_parsed);
			//system("clear");
			scan_host_by_ip(com_parsed);		
		}
		if(c == '3')	break;
		//system("pause");
		//system("clear");
		display();
		printf("please input one of the numbers above\n");
		c = getchar();
		getchar();
	}
			
}
Exemple #2
0
int extract_image(void* user_struct)
{
    struct stream_state stream;
    struct blob_list blist;
    struct blob* blob_now = NULL;
    struct blob* blob_prev = NULL;

    if (init_pixel_stream(user_struct, &stream))
        {printf("init malloc error!\n"); return 1;}
    if (stream.row == NULL)
        {printf("row malloc error!\n"); return 1;}
    blist.length = stream.w + 5;
    if (malloc_blobs(&blist))
        {printf("blob malloc error!\n"); return 1;}

    while (!next_frame(user_struct, &stream))
    {
        init_blobs(&blist);
        while (!next_row(user_struct, &stream))
        {
            blob_prev = blist.head->next;
            while (!stream.wrap)
            {
                blob_now = empty_blob(&blist);
                if (scan_segment(&stream, blob_now))
                    {blob_reap(&blist, blob_now); continue;}
                blob_update(blob_now, blob_now->x1, blob_now->x2, stream.y);
                // update structure
                sib_find(blist.head->next, blob_now);
                blob_insert(blob_prev, blob_now);
                flush_incremental(user_struct, &blist, blob_now);
                blob_prev = blob_now;
            }
            flush_old_blobs(user_struct, &blist, stream.y);
            //show_status(blist.head, &stream);
            //show_dead_sibs(blist.head);
            //show_blobs(blist.head);
            //printf("----------\n");
        }
        flush_old_blobs(user_struct, &blist, stream.h - 1);
    }

    close_pixel_stream(user_struct, &stream);
    free(blist.head);
    free(blist.empties);
    blist.head = NULL;
    blist.empties = NULL;
    return 0; 
}