Esempio n. 1
0
void allStrings(struct StringTable *st, StringTableIterator sti, void *udata)
{
  audata = udata;
  asti = sti;
  ast = st;
  twalk(st->stringTableNodeTab, allFunc);
}
Esempio n. 2
0
int ffindex_tree_write(ffindex_index_t* index, FILE* index_file)
{
  ffindex_tree_write_action_ret = EXIT_SUCCESS;
  ffindex_tree_write_action_index_file = index_file;
  twalk(index->tree_root, ffindex_tree_write_action);
  return ffindex_tree_write_action_ret; 
}
Esempio n. 3
0
void vlc_tdestroy (void *root, void (*freenode) (void *))
{
    const void **tab;
    size_t count;

    assert (freenode != NULL);

    /* Enumerate nodes in order */
    vlc_mutex_lock (&list.lock);
    assert (list.count == 0);
    twalk (root, list_nodes);
    tab = list.tab;
    count = list.count;
    list.tab = NULL;
    list.count = 0;
    vlc_mutex_unlock (&list.lock);

    /* Destroy the tree */
    vlc_mutex_lock (&smallest.lock);
    for (size_t i = 0; i < count; i++)
    {
         smallest.node = tab[i];
         if (tdelete (smallest.node, &root, cmp_smallest) == NULL)
             abort ();
    }
    vlc_mutex_unlock (&smallest.lock);
    assert (root == NULL);

    /* Destroy the nodes */
    for (size_t i = 0; i < count; i++)
         freenode ((void *)(tab[i]));
    free (tab);
}
Esempio n. 4
0
void ldl_datablock::AddTemplateChildrenTo(ldl_datablock *block)
{

	PointerList<ldl_datablock>::Walker bwalk;
	for(bwalk.SetList(&m_children); bwalk.IsValid(); bwalk.Next()) {

		PointerList<ldl_datablock>::Walker chwalk(&block->m_children);
		bool alreadyHaveIt = false;
		for(;chwalk.IsValid(); chwalk.Next()) {

			if(chwalk.GetObj()->GetName() == bwalk.GetObj()->GetName()) {

				chwalk.GetObj()->CopyAttributesFrom(bwalk.GetObj());

				PointerList<ldl_datablock>::Walker twalk(&bwalk.GetObj()->m_templates);
				for(; twalk.IsValid(); twalk.Next()) {
					chwalk.GetObj()->m_templates.AddTail(twalk.GetObj());
				}

				chwalk.GetObj()->AddTemplateChildren();

				alreadyHaveIt = true;
				break;
			}
		}
		if(!alreadyHaveIt) {
			ldl_datablock *newblock = new ldl_datablock(bwalk.GetObj());
			block->AddChild(newblock);
			newblock->AddTemplateChildren();
			ldlif_add_block_to_tree(newblock);
		}
	}
}
Esempio n. 5
0
void
hash_table_assert_integrity(struct hash_table *hash)
{
	unsigned int i;
	int used=0;

	/* For thread safety */
	while (hash->foo != NULL)
		;

	for (i=0; i < hash->size; i++)
		if (hash->table[i] != NULL)
		{
			hash->foo=&i;
			twalk(hash->table[i]->tree,
			      hash_tree_walk_assert_integrity);
			used+=hash->table[i]->count;
		}

	if (used != hash->used)
	{
		fprintf(stderr,"HASH INTEGRITY TEST FAILD\n");
		abort();
	}

	fprintf(stderr,"HASH OK\n");

	hash->foo=NULL;
}
Esempio n. 6
0
int main() {
  int i, *ptr;
  void *root = NULL;
  const void *ret;
  foo_t *val, *val2;

  val = calloc(1, sizeof(foo_t));
  val->name = strdup("one");
  val->value = 1;
  printf("name: %s\n", val->name);
  ret = tsearch(val, &root, cmp);
  printf("retname: %s\n", (*(foo_t **)ret)->name);

  val2 = calloc(1, sizeof(foo_t));
  val2->name = strdup(val->name);
  val2->value = 3;
  printf("name: %s\n", val->name);
  ret = tsearch(val, &root, cmp);
  printf("val2 result: %d\n", (*(foo_t **)ret)->value);

  printf("Walking with twalk\n");
  twalk(root, walker);
  return 0;

}
Esempio n. 7
0
/*
 * ===  FUNCTION  ======================================================================
 *         Name:  process_queue
 *  Description:  Reads messages from queue and places them in a search tree
 *                using the tsearch() function.  When all messages have been read, traverses
 *                the tree, sending messages based upon the alphabetical order of the mtext
 *                field.
 * =====================================================================================
 */
static int
process_queue(int msqid, size_t maxmsgsz, long msgtyp, int msgflg,
        int(*compar)(const void *, const void *),
        void (*action)(const void *nodep, const VISIT value, const int level))
{
    int ret;
    msg_t *msg = NULL, *msg_node = NULL;
    void *root = NULL, *node = NULL;
    int msgsnd_flag = 0;

    while(1) {
        /* Each node of the tree must be separately
         * allocated. */
        msg = xmalloc(sizeof(msg_t));
        ret = msgrcv(msqid, msg, maxmsgsz, msgtyp, msgflg);
        if(ret == -1) {
            perror("process_queue: msgrcv");
            _exit(EXIT_FAILURE);
        }
        /* If msg's count field == -1, there are
         * no more messages to process. */
        if(msg->count == -1) {
            free(msg);
            break;
        }
        node = tsearch(msg, &root, compar);
        /* If 'node' is NULL, tsearch failed to insert
         * the message into the tree. */
        if(node == NULL) {
            perror("tsearch");
            _exit(EXIT_FAILURE);
        } else {
            msg_node = *(msg_t **)node;
            /* Check whether the newly-inserted node
             * points to the same place as 'msg'.  If it
             * doesn't, increment the node's count field
             * and free msg. */
            if(msg_node != msg) {
                msg_node->count++;
                free(msg);
            }
        }
    }

    /* Place messages in queue in
     * alphabetical order */
    twalk(root, action);

    /* Free the memory associated
     * with the tree */
    tdestroy(root, &free);

    /* Send terminating message to parent */
    if(msgsnd_str(child_queue, 1, msgsnd_flag, msgtyp, "", -1) == -1) {
        perror("msgsnd_str");
        _exit(EXIT_FAILURE);
    }

    return ret;
}
Esempio n. 8
0
void ow_regdestroy( void )
{
	// twalk( regex_tree, regexaction ) ;
	twalk( regex_tree, regexkillaction ) ;
	SAFETDESTROY( regex_tree, owfree_func ) ;
	LEVEL_DEBUG("Regex destroy done") ;
	regex_tree = NULL ;
}
Esempio n. 9
0
int
main()
{
	for (int i = 0; i < 1000; i++)
		add(rand()%13);
	
	twalk(tree, print_node);
}
Esempio n. 10
0
void DumpVariables(vlc_object_t *obj)
{
    vlc_mutex_lock(&vlc_internals(obj)->var_lock);
    if (vlc_internals(obj)->var_root == NULL)
        puts(" `-o No variables");
    else
        twalk(vlc_internals(obj)->var_root, DumpVariable);
    vlc_mutex_unlock(&vlc_internals(obj)->var_lock);
}
Esempio n. 11
0
void Aliaslist( struct memblob * mb  )
{
	PERSISTENT_RLOCK ;
	ALIASLISTLOCK ;
	aliaslist_mb = mb ;
	twalk(cache.persistent_tree, Aliaslistaction);
	ALIASLISTUNLOCK ;
	PERSISTENT_RUNLOCK ;
}
Esempio n. 12
0
void save()
{
fd = fopen("data/stored.txt","w");
if (fd!=NULL)
twalk(map->root, action);
if (fd!=NULL)
fclose(fd);
datastore_destroy(map);
free(map);
}
Esempio n. 13
0
void print_statistics(void * ps_tree)
{
    /* Statistics data */
    unsigned int num_files = 0, max_file_len = 0, total_file_len = 0;
    unsigned int total_revisions = 0, max_revisions_for_file = 0;
    unsigned int total_branches = 0, max_branches_for_file = 0;
    unsigned int total_branches_sym = 0, max_branches_sym_for_file = 0;

    /* Other vars */
    struct hash_entry *he;
   
    printf("Statistics:\n");
    fflush(stdout);

    /* Gather file statistics */
    reset_hash_iterator(file_hash);
    while ((he=next_hash_entry(file_hash)))
    {
	int len = strlen(he->he_key);
	CvsFile *file = (CvsFile *)he->he_obj;
	
	num_files++;
	max_file_len = MAX(max_file_len, len);
	total_file_len += len;

	count_hash(file->revisions, &total_revisions, &max_revisions_for_file);
	count_hash(file->branches, &total_branches, &max_branches_for_file);
	count_hash(file->branches_sym, &total_branches_sym,
	    &max_branches_sym_for_file);
    }

    /* Print file statistics */
    printf("Num files: %d\nMax filename len: %d, Average filename len: %.2f\n",
	    num_files, max_file_len, (float)total_file_len/num_files);

    printf("Max revisions for file: %d, Average revisions for file: %.2f\n",
	  max_revisions_for_file, (float)total_revisions/num_files);
    printf("Max branches for file: %d, Average branches for file: %.2f\n",
	  max_branches_for_file, (float)total_branches/num_files);
    printf("Max branches_sym for file: %d, Average branches_sym for file: %.2f\n",
	  max_branches_sym_for_file, (float)total_branches_sym/num_files);

    /* Gather patchset statistics */
    twalk(ps_tree, stat_ps_tree_node);

    /* Print patchset statistics */
    printf("Num patchsets: %d\n", num_patch_sets);
    printf("Max PS members in PS: %d\nAverage PS members in PS: %.2f\n",
	    max_ps_member_in_ps, (float)num_ps_member/num_patch_sets);
    printf("Num authors: %d, Max author len: %d, Avg. author len: %.2f\n", 
	    num_authors, max_author_len, (float)total_author_len/num_authors);
    printf("Max desc len: %d, Avg. desc len: %.2f\n",
	    max_descr_len, (float)total_descr_len/num_patch_sets);
}
Esempio n. 14
0
/**
   Register routines to be called with mem.c is unloading (deinit).
 */
void memdbg_report(void){
    memdbg_toreport=0;
    int disable_save=disable_memdbg;
    disable_memdbg=1;
    if(MROOT){
	info("%ld (%.3f B) allocated memory not freed!!!\n",
	     memcnt, (memalloc-memfree));
	twalk(MROOT,stat_usage);
	info("stat_usage is done\n");
	twalk(MSTATROOT, print_usage);
    }else{
	info("All allocated memory are freed.\n");
	if(memcnt>0){
	    info("But memory count is still none zero: %ld\n",memcnt);
	}
    }
    info("Total allocated memory is %.3f MB\n", memalloc/1024./1024.);
    info("Total freed     memory is %.3f MB\n", memfree/1024./1024.);
    disable_memdbg=disable_save;
}
Esempio n. 15
0
/* check if there is any malloc residue */
int ncmpii_inq_malloc_list(void)
{
#ifdef PNC_MALLOC_TRACE
    /* check if malloc tree is empty */
    if (ncmpii_mem_root != NULL)
        twalk(ncmpii_mem_root, walker);
    return 1;
#else
    return 0;
#endif
}
Esempio n. 16
0
File: tree.c Progetto: mykmo/types
void tree_foreach(tree_t *tree, tree_walker_t walk, void *data)
{
	__extension__
	void action(const void *nodep, const VISIT which, const int depth)
	{
		if (which == postorder || which == leaf)
			walk(*(void **) nodep, data);
	}

	twalk(tree->root, action);
}
Esempio n. 17
0
/*
fork a sort process and read in data from the
parser message queue.
*/
void sort(int q_number, int sort_process_no ){
  mess_t message2;
  struct wordNode *newWord;
  int combiner_queue_no;
  void *root = NULL;
  int child;

  if((child = fork()) == 0){

      // child process # 2 starts here
      // connect to processer queue
      key = ftok(__FILE__,'x');
      message_queue = msgget(key, QUEUE_PERMS );

      // connect to the numbered combiner queue
      combiner_queue_no = msgget(q_number, QUEUE_PERMS );

      // read from the parser queue waiting for a message with
      // sort_process_no
      while(msgrcv(message_queue, &message2, MSG_SIZE, sort_process_no, MSG_NOERROR) != -1 ){

        // see if we got the end message
        if(strcmp(message2.msg, "tokenizer_finished") == 0){
          break;
        }

        // allocate memory for word and set up message struct
        newWord = malloc(sizeof(struct wordNode));
        strcpy(newWord->word,message2.msg);
        newWord->number = 1;
        newWord->q_to_combiner = combiner_queue_no;

        // add to the binary tree
        tsearch(newWord, & root, compare);
      }  // end while

      // do an postorder traversal and send the data to the combiner
      twalk(root, send_to_combiner);

      // send end of sort message
      newWord = malloc(sizeof(struct wordNode));
      strcpy(newWord->word,"sort_finished");
      newWord->number = 1;
      newWord->q_to_combiner = combiner_queue_no;
      newWord->mtype = 1;

      if(msgsnd(combiner_queue_no, newWord, sizeof(struct wordNode), MSG_NOERROR)== -1){
        perror("end sort message failed: ");
      }
      _exit(EXIT_SUCCESS);
  }
}
Esempio n. 18
0
/* Takes O(N)
 */
int
hash_table_resize(struct hash_table *hash, float new_load)
{
	int i;
	int size;

	if (new_load < hash->resize_load)
		return -1;

	if (!hash_table_get_used(hash))
		return -1;

	while (hash->foo != NULL)
		;

	size=hash->size;

	realloc_hash_table(hash,(size_t)ceilf((float)hash->used/new_load));

	set_hash_table_empty(hash,size,hash->size-1);

	for (i=0; i < size; i++)
		if (hash->table[i] != NULL)
		{
			hash->foo=&i;

			list_init(&hash->del_list);

			twalk(hash->table[i]->tree,hash_tree_walk_table_resize);

			delete_elements_from_tree(hash,&hash->table[i]->tree);

			hash->table[i]->count-=list_size(&hash->del_list);

			list_free(&hash->del_list,NULL);

			if (hash->table[i]->tree == NULL)
			{
				free(hash->table[i]);
				hash->table[i]=NULL;
			}
		}

	hash->foo=NULL;

#if HASH_TABLE_DEBUG
	hash_table_assert_integrity(hash);
#endif

	return 0;
}
Esempio n. 19
0
TEST_SEPARATE_PROCESS(twalk, example) {
  // The numbers to insert into the tree.
  for (size_t i = 0; i < NELEMENTS; ++i)
    numbers[i] = i;

  // Generate random order in which elements should be inserted.
  size_t insertion_order[NELEMENTS];
  for (size_t i = 0; i < NELEMENTS; ++i)
    insertion_order[i] = i;
  for (ssize_t i = NELEMENTS - 1; i > 0; --i) {
    size_t j = arc4random_uniform(i);
    int tmp = insertion_order[i];
    insertion_order[i] = insertion_order[j];
    insertion_order[j] = tmp;
  }

  // Insert all elements into the tree in random order.
  void *root = NULL;
  for (size_t i = 0; i < NELEMENTS; ++i) {
    // Entry should not exist yet.
    int *keyp = &numbers[insertion_order[i]];
    ASSERT_EQ(NULL, tfind(keyp, &root, compar_int));
    ASSERT_EQ(NULL, tdelete(keyp, &root, compar_int));
    // Insertion should create new node in tree.
    ASSERT_EQ(keyp, *(int **)tsearch(keyp, &root, compar_int));
  }
  for (size_t i = 0; i < NELEMENTS; ++i) {
    // Successive searches should always return this node, even when
    // provided a different instance of the same key.
    int *keyp = &numbers[insertion_order[i]];
    int key = *keyp;
    ASSERT_EQ(keyp, *(int **)tfind(&key, &root, compar_int));
    ASSERT_EQ(keyp, *(int **)tsearch(&key, &root, compar_int));
  }

  // Invoke twalk() and check the order in which it iterates.
  twalk(root, traverse);
  ASSERT_EQ(NELEMENTS, next_key);
  ASSERT_EQ(-1, current_level);

  // Remove all elements from the tree.
  for (size_t i = 0; i < NELEMENTS; ++i) {
    int *keyp = &numbers[insertion_order[i]];
    int key = *keyp;
    ASSERT_NE(NULL, tdelete(&key, &root, compar_int));
    ASSERT_EQ(NULL, tdelete(&key, &root, compar_int));
    ASSERT_EQ(NULL, tfind(keyp, &root, compar_int));
  }
  ASSERT_EQ(NULL, root);
}
Esempio n. 20
0
void main()
{
	fun();
	twalk(root, action);
	int key = 10;
	void *p = tfind((void *)&key, &root, compare);
	if(p)
	{
		int *pint = *(int **)p;
		printf("tfind key >>> p = %p, pint = %p, *pint = %d\n\n", p, pint, *pint);
	}

	p = tdelete((void *)&key, &root, compare);
	if(p)
	{
		int *pint = *(int **)p;
		printf("tdelete key, key's father is >>> p = %p, pint = %p, *pint = %d\n\n", p, pint, *pint);
	}
	twalk(root, action);

	tdestroy(root, free);
	exit(EXIT_SUCCESS);
}
int main(int argc, char** argv) 
{
	if (argc != 6) {
		fprintf(stderr, "Usage: %s <prefix-file> <tsdb-file> " 
			"<profile_dir> <capfile> <unix-timestamp>\n", argv[0]);
		exit(1);
	}
	char* prefix_file = argv[1];
	char* tsdb_file = argv[2];
	char* profile_dir = argv[3];
	char* capfile = argv[4];
	time_t epoch = atoi(argv[5]);

        uint16_t vals_per_entry = 1; // defines how many entries we can have
                                     // we currently store one value per entry.
                                     // this means we do not group by IP_interface
                                     // but have a value vor IP_interface_ifInOctets, ...
                                     // maybe we want to change that
        uint16_t slot_seconds = 300; // defines measurment interval


	struct lpm_tree* tree = read_prefix_file(prefix_file);
	if (!tree) {
		fprintf(stderr, "ERROR: Could not create subnet tree!\n");
		exit(1);
	}

	if (0 != tsdb_open(tsdb_file, &db, &vals_per_entry, slot_seconds, 0)) {
		fprintf(stderr, "ERROR: Could not open tsdb database!\n");
		exit(1);
	}

	if (0 != tsdb_goto_epoch(&db, epoch, 0, 1)) {
		fprintf(stderr, "ERROR: Could not set epoch to %u\n", epoch);
		exit(1);
	}

	fprintf(stderr, "reading nfdump files ...\n");
	read_nfdump_files(profile_dir, capfile, tree);
	fprintf(stderr, "Dumping to tsdb ... \n");
	twalk(network_tree, &store_records_in_db);

	fprintf(stderr, "Cleaning up!\n");
	lpm_destroy(tree);
	tsdb_flush(&db);
	tsdb_close(&db);

	return 0;
}
Esempio n. 22
0
File: objects.c Progetto: paa/vlc
/*****************************************************************************
 * DumpCommand: print the current vlc structure
 *****************************************************************************
 * This function prints either an ASCII tree showing the connections between
 * vlc objects, and additional information such as their refcount, thread ID,
 * etc. (command "tree"), or the same data as a simple list (command "list").
 *****************************************************************************/
static int DumpCommand( vlc_object_t *p_this, char const *psz_cmd,
                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    (void)oldval; (void)p_data;
    vlc_object_t *p_object = NULL;

    if( *newval.psz_string )
    {
        /* try using the object's name to find it */
        p_object = vlc_object_find_name( p_this, newval.psz_string,
                                         FIND_ANYWHERE );
        if( !p_object )
        {
            return VLC_ENOOBJ;
        }
    }

    libvlc_lock (p_this->p_libvlc);
    if( *psz_cmd == 't' )
    {
        char psz_foo[2 * MAX_DUMPSTRUCTURE_DEPTH + 1];

        if( !p_object )
            p_object = VLC_OBJECT(p_this->p_libvlc);

        psz_foo[0] = '|';
        DumpStructure( vlc_internals(p_object), 0, psz_foo );
    }
    else if( *psz_cmd == 'v' )
    {
        if( !p_object )
            p_object = p_this->p_libvlc ? VLC_OBJECT(p_this->p_libvlc) : p_this;

        PrintObject( vlc_internals(p_object), "" );
        vlc_mutex_lock( &vlc_internals( p_object )->var_lock );
        if( vlc_internals( p_object )->var_root == NULL )
            puts( " `-o No variables" );
        else
            twalk( vlc_internals( p_object )->var_root, DumpVariable );
        vlc_mutex_unlock( &vlc_internals( p_object )->var_lock );
    }
    libvlc_unlock (p_this->p_libvlc);

    if( *newval.psz_string )
    {
        vlc_object_release( p_object );
    }
    return VLC_SUCCESS;
}
Esempio n. 23
0
static const ASCII *namefind(const char *name)
{
	const ASCII *ret;

	NAMEFINDLOCK;

	global_namefind_struct.readable_name = name;
	global_namefind_struct.ret = NULL;
	twalk(Tree[ePN_real], Namefindaction);
	ret = global_namefind_struct.ret;

	NAMEFINDUNLOCK;

	return ret;
}
Esempio n. 24
0
int main (int argc, char **argv)
{
 void *root = NULL;
 void *nodep;

 tsearch("aaa", &root, node_cmp);
 tsearch("bbb", &root, node_cmp);
 tsearch("ccc", &root, node_cmp);
 printf("---------- tree after insertion of 3 nodes:\n");
 twalk(root, print_node);

 printf("----------\n");

 while ((nodep = tfind(NULL, &root, node_any)))
 {
   const char *key = * (const char **) nodep;
   tdelete(key, &root, node_cmp);
 }
 printf("---------- tree after deletion of all nodes using tfind()+tdelete():\n");
 twalk(root, print_node);
 printf("----------\n");

 tsearch("ddd", &root, node_cmp);
 tsearch("eee", &root, node_cmp);
 tsearch("fff", &root, node_cmp);
 printf("---------- tree after insertion of 3 new nodes:\n");
 twalk(root, print_node);
 printf("----------\n");
 while (tdelete(NULL, &root, node_any) != NULL)
   ;
 printf("---------- tree after deletion of all nodes using tdelete() only:\n");
 twalk(root, print_node);
 printf("----------\n");
 printf("Passed\n");
 return 0;
}
Esempio n. 25
0
void
__pmCountPDUBuf(int need, int *alloc, int *free)
{
    PM_INIT_LOCKS();
    PM_LOCK(__pmLock_libpcp);

    pdu_bufcnt_need = need;
    pdu_bufcnt = 0;
    twalk(buf_tree, &pdubufcount);
    *alloc = pdu_bufcnt;

    *free = 0;			/* We don't retain freed nodes. */

    PM_UNLOCK(__pmLock_libpcp);
}
Esempio n. 26
0
static void
pdubufdump(void)
{
    /*
     * There is no longer a pdubuf free list, ergo no
     * fprintf(stderr, "   free pdubuf[size]:\n");
     */
    PM_LOCK(__pmLock_libpcp);
    if (buf_tree != NULL) {
	fprintf(stderr, "   pinned pdubuf[size](pincnt):");
	twalk(buf_tree, &pdubufdump1);
	fprintf(stderr, "\n");
    }
    PM_UNLOCK(__pmLock_libpcp);
}
Esempio n. 27
0
/* When an application destroy an NI, it cannot just close its
 * connections because there might be some packets in flight. So it
 * just informs the remote sides that it is ready to shutdown. */
void initiate_disconnect_all(ni_t *ni)
{
    if (ni->options & PTL_NI_LOGICAL) {
        int i;
        const int map_size = ni->logical.map_size;

        /* Send a disconnect message. */
        for (i = 0; i < map_size; i++) {
            conn_t *conn = ni->logical.rank_table[i].connect;

            initiate_disconnect_one(conn);
        }
    } else {
        twalk(ni->physical.tree, initiate_disconnect_one_twalk);
    }
}
Esempio n. 28
0
static void
dump_symtab(CLASS * p, DumpFunc dumpFunc)
{
#if USE_TSEARCH
    dump_func = dumpFunc;
    twalk(p->data, dump_walker);
#else
    int i;
    KEYWORD *q;

    for (i = 0; i < HASH_LENGTH; i++) {
	for (q = p->data[i]; q != 0; q = q->kw_next) {
	    dumpFunc(q);
	}
    }
#endif
}
Esempio n. 29
0
void
hash_table_walk(struct hash_table *hash, void (*action)(void *))
{
	unsigned int i;

	/* For thread safety */
	while (hash->foo != NULL)
		;

	hash->foo=(void*)action;

	for (i=0; i < hash->size; i++)
		if (hash->table[i] != NULL)
			twalk(hash->table[i]->tree,hash_tree_walk);

	hash->foo=NULL;
}
Esempio n. 30
0
void	zkt_list_trustedkeys (const dki_t *data)
{

	/* print headline if list is not empty */
	if ( data && headerflag )
		printf ("trusted-keys {\n");

#if defined(USE_TREE) && USE_TREE
	twalk (data, list_trustedkey);
#else
	for ( dkp = data; dkp; dkp = dkp->next )	/* loop through list */
		if ( (dki_isksk (dkp) || zskflag) &&
		     (labellist == NULL || isinlist (dkp->name, labellist)) )
			dki_prt_trustedkey (dkp, stdout);
#endif

	/* print end of trusted-key section */
	if ( data && headerflag )
		printf ("};\n");
}