Example #1
0
void print_directory(struct request_t * req){
    DIR * dir = opendir(req->path);
    struct dirent * entry = NULL;
    
    if (dir == NULL){
        perror(NULL);
        return;
    }
    
    while( (entry = readdir(dir)) != NULL ){
        if( (*entry).d_name[0] == '.' ) continue; // don't print hidden files/dirs
            
        char type = resolve_item(entry);
        char * sel = NULL;
        asprintf(&sel, "%s/%s", req->selector, entry->d_name);
        
        menu_item * item = menu_item_new(type, entry->d_name, sel, DEFAULT_HOST, DEFAULT_PORT);
        print_menu_item(req->fd, item);
        menu_item_free(item);
        free(sel);
    }
    
    print_closing(req->fd);
    if( closedir(dir) != 0 )
        perror(NULL);
}
Example #2
0
File: Menu.c Project: tobynet/clcl
/*
 * menu_item_free - メニュー情報の解放
 */
static void menu_item_free(MENU_ITEM_INFO *mii, int cnt)
{
	int i;

	if (mii == NULL) {
		return;
	}
	for (i = 0; i < cnt; i++) {
		if ((mii + i)->mii != NULL) {
			menu_item_free((mii + i)->mii, (mii + i)->mii_cnt);
		}
		mem_free(&((mii + i)->text));
		mem_free(&((mii + i)->hkey));
		if ((mii + i)->free_icon == TRUE && (mii + i)->icon != NULL) {
			DestroyIcon((mii + i)->icon);
		}
	}
	mem_free(&mii);
}
Example #3
0
File: Menu.c Project: tobynet/clcl
/*
 * menu_free - メニュー情報の解放
 */
void menu_free(void)
{
	menu_item_free(menu_item_info, menu_item_cnt);
	menu_item_info = NULL;
	menu_item_cnt = 0;
}
Example #4
0
static void menu_item_free__(void * arg) {
    menu_item_free( (menu_item_type *) arg );
}