コード例 #1
0
ファイル: libacpi.c プロジェクト: GiuseppeMassari/libacpi
/* reads the names of the fan directories, fills fan_t,
 * return 0 on success, negative values on errors */
int
init_acpi_fan(global_t *globals){
	char *names[MAX_ITEMS];
	list_t *lst = NULL;
	node_t *node = NULL;
	int i = 0;
	fan_t *finfo = NULL;
	globals->fan_count = 0;

	if((lst = dir_list(PROC_ACPI "fan")) == NULL || !lst->top)
		return NOT_SUPPORTED;
	for(node = lst->top; node; node = node->next){
		if((names[globals->fan_count] = strdup(node->name)) == NULL){
			delete_list(lst);
			return ALLOC_ERR;
		}
		globals->fan_count++;
	}

	if(globals->fan_count > MAX_ITEMS) return ITEM_EXCEED;

	for (; i < globals->fan_count && i < MAX_ITEMS; i++){
		finfo = &fans[i];
		snprintf(finfo->name, MAX_NAME, "%s", names[i]);
		snprintf(finfo->state_file, MAX_NAME, PROC_ACPI "fan/%s/state", names[i]);
		free(names[i]);
	}
	delete_list(lst);
	read_acpi_fans(globals);
	return SUCCESS;
}
コード例 #2
0
ファイル: libacpi.c プロジェクト: GiuseppeMassari/libacpi
/* reads the name of the thermal-zone directory and fills the adapter_t
 * structure with the name and the state-file. Return 0 on success, negative values on errors */
int
init_acpi_thermal(global_t *globals){
	char *names[MAX_ITEMS];
	list_t *lst = NULL;
	node_t *node = NULL;
	thermal_t *tinfo = NULL;
	int i = 0;
	globals->thermal_count = 0;

	if((lst = dir_list(PROC_ACPI "thermal_zone")) == NULL)
		return NOT_SUPPORTED;
	for(node = lst->top; node; node = node->next){
		if((names[globals->thermal_count] = strdup(node->name)) == NULL){
			delete_list(lst);
			return ALLOC_ERR;
		}
		globals->thermal_count++;
	}

	if(globals->thermal_count > MAX_ITEMS) return ITEM_EXCEED;

	for (; i < globals->thermal_count && i < MAX_ITEMS; i++){
		tinfo = &thermals[i];
		snprintf(tinfo->name, MAX_NAME, "%s", names[i]);
		snprintf(tinfo->state_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/state", names[i]);
		snprintf(tinfo->temp_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/temperature", names[i]);
		snprintf(tinfo->cooling_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/cooling_mode", names[i]);
		snprintf(tinfo->freq_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/polling_frequency", names[i]);
		snprintf(tinfo->trips_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/trip_points", names[i]);
		free(names[i]);
	}
	delete_list(lst);
	read_acpi_thermalzones(globals);
	return SUCCESS;
}
コード例 #3
0
ファイル: libacpi.c プロジェクト: GiuseppeMassari/libacpi
/* reads the name of the ac-adapter directory and fills the adapter_t
 * structure with the name and the state-file. Return 0 on success, negative values on errors */
int
init_acpi_acadapt(global_t *globals){
	list_t *lst = NULL;
	adapter_t *ac = &globals->adapt;

	globals->sysstyle = 0;
	if((lst = dir_list(PROC_ACPI "ac_adapter")) == NULL || !lst->top)
	{
		if((lst = dir_list(SYS_POWER "/AC")) == NULL || !lst->top)
			return NOT_SUPPORTED;
		else
			globals->sysstyle = 1;
	}
	if((!lst->top->name || ((ac->name = strdup(lst->top->name)) == NULL))){
		delete_list(lst);
		return ALLOC_ERR;
	}
	if(globals->sysstyle)
		snprintf(ac->state_file, MAX_NAME, SYS_POWER "/AC/online");
	else
		snprintf(ac->state_file, MAX_NAME, PROC_ACPI "ac_adapter/%s/state", ac->name);
	delete_list(lst);
	read_acpi_acstate(globals);
	return SUCCESS;
}
コード例 #4
0
int main() {
	node* head = new node(0);
	node* app = head;
	for(int i = 0; i < 10; ++i) {
		append(app, i);
		app = app->next;
	}
	remove_duplicates(head);
	node* curr = head;
	while(curr) {
		std::cout << curr->data << " ";
		curr = curr->next;
	}
	std::cout << std::endl;
	delete_list(head);

	head = new node(0);
	app = head;
	for(int i = 0; i < 10; ++i) {
		append(app, i);
		app = app->next;
	}
	remove_dups_hash(head);
	curr = head;
	while(curr) {
		std::cout << curr->data << " ";
		curr = curr->next;
	}
	std::cout << std::endl;
	delete_list(head);
}
コード例 #5
0
ファイル: config.c プロジェクト: adlr/OpenEmu
m64p_error ConfigShutdown(void)
{
    /* first, save the file if necessary */
    if (l_SaveConfigOnExit)
        ConfigSaveFile();

    /* reset the initialized flag */
    if (!l_ConfigInit)
        return M64ERR_NOT_INIT;
    l_ConfigInit = 0;

    /* free any malloc'd local variables */
    if (l_DataDirOverride != NULL)
    {
        free(l_DataDirOverride);
        l_DataDirOverride = NULL;
    }
    if (l_ConfigDirOverride != NULL)
    {
        free(l_ConfigDirOverride);
        l_ConfigDirOverride = NULL;
    }

    /* free all of the memory in the 2 lists */
    delete_list(&l_ConfigListActive);
    delete_list(&l_ConfigListSaved);

    return M64ERR_SUCCESS;
}
コード例 #6
0
ファイル: test_builtins.c プロジェクト: plean/PSU
void	test_exit(char *buffer, t_list *list)
{
  char	**tab;

  tab = NULL;
  if (buffer == NULL || buffer == 0)
    {
      free(buffer);
      write(1, "exit\n", 5);
      delete_list(&list);
      exit(0);
    }
  tab = my_str_to_tab(buffer, ' ', 9);
  if (tab[0] != NULL)
    if (my_strcmp_exit(tab[0], "exit"))
      {
	if (!tab[1] || (tab[1] && !tab[2]))
	  {
	    delete_list(&list);
	    free(buffer);
	    write(1, "exit\n", 5);
	    free(tab);
	    exit(my_getnbr(tab[1]));
	  }
	write(2, "exit: Expression Syntax.\n", 25);
      }
  free(tab);
}
コード例 #7
0
ファイル: server.c プロジェクト: hanappe/opensensordata.net
void request_clear(request_t* request)
{
        list_t* n;

        if (request->path) 
                free(request->path);

        n = request->pathnodes;
        while (n) {
                free(n->data);
                n = n->next;
        }
        delete_list(request->pathnodes);

        n = request->args;
        while (n) {
                delete_pair((pair_t*)n->data);
                n = n->next;
        }
        delete_list(request->args);

        n = request->headers;
        while (n) {
                delete_pair((pair_t*)n->data);
                n = n->next;
        }
        delete_list(request->headers);

        if (request->body) 
                free(request->body);

        memset(request, 0, sizeof(request_t));
}
コード例 #8
0
ファイル: flow_table.c プロジェクト: kazuyas/trema-edge
flow_entry *
lookup_flow_entry( const uint8_t table_id, const match *match ) {
  assert( valid_table_id( table_id ) || table_id == FLOW_TABLE_ALL );

  if ( !lock_pipeline() ) {
    return NULL;
  }

  // FIXME: allocating/freeing linked list elements may cost.

  list_element *list = NULL;
  if ( table_id != FLOW_TABLE_ALL ) {
    list = lookup_flow_entries_with_table_id( table_id, match, 0, false, true );
  }
  else {
    list = lookup_flow_entries_from_all_tables( match, 0, false, true );
  }

  if ( !unlock_pipeline() ) {
    delete_list( list );
    return NULL;
  }

  flow_entry *entry = NULL;
  if ( list != NULL ) {
    entry = list->data;
    delete_list( list );
  }

  return entry;
}
コード例 #9
0
ファイル: switch.c プロジェクト: Milstein/trema
static void
stop_switch() {
  if ( switch_info.secure_channel_fd >= 0 ) {
    close( switch_info.secure_channel_fd );
    switch_info.secure_channel_fd = -1;
  }
  uint8_t state = MESSENGER_OPENFLOW_DISCONNECTED;
  if ( switch_info.state == SWITCH_STATE_CONNECTION_FAILED ) {
    state = MESSENGER_OPENFLOW_FAILD_TO_CONNECT;
  }
  service_send_state( &switch_info, &switch_info.datapath_id, state );
  flush_messenger();

  // free service name list
  iterate_list( switch_info.vendor_service_name_list, xfree_data, NULL );
  delete_list( switch_info.vendor_service_name_list );
  switch_info.vendor_service_name_list = NULL;
  iterate_list( switch_info.packetin_service_name_list, xfree_data, NULL );
  delete_list( switch_info.packetin_service_name_list );
  switch_info.packetin_service_name_list = NULL;
  iterate_list( switch_info.portstatus_service_name_list, xfree_data, NULL );
  delete_list( switch_info.portstatus_service_name_list );
  switch_info.portstatus_service_name_list = NULL;
  iterate_list( switch_info.state_service_name_list, xfree_data, NULL );
  delete_list( switch_info.state_service_name_list );
  switch_info.state_service_name_list = NULL;

  stop_trema();
}
コード例 #10
0
ファイル: server_destroy_io.c プロジェクト: jlouazel/zhappy
const t_io	*destroy_server_io(const t_io *io)
{
  if (io)
    {
      delete_list(io->in, NULL);
      delete_list(io->out, NULL);
    }
  return (NULL);
}
コード例 #11
0
ファイル: asteroids2.c プロジェクト: ThomasWitte/minigames
void game_over(Game *g) {
    while(!key[KEY_ENTER])
        if(key[KEY_ESC]) {
            g->end = 1;
            return;
        }

    delete_list(g->asteroids);
    delete_list(g->shot);
    delete_list(g->particles);
    init_game(g);
}
コード例 #12
0
void cleanup(node_data **data){
    
    if ((*data)->neighbours)
        delete_list(&(((*data)->neighbours)->head));
        
    if ((*data)->neighbours_cost)
        delete_list(&(((*data)->neighbours_cost)->head));
        
    if ((*data)->messages)    
        delete_list(&(((*data)->messages)->head));
    
    free(*data);
   
    *data = NULL;
}
コード例 #13
0
PyObject* getAngles(PyObject *self, PyObject *args) {
/*
** Inputs:
** 	interger of search radius (in pixels)
** Modifies:
** 	nothing
** Outputs:
** 	1D numpy array containing correlation values of angle (x-axis)
*/
	Py_Initialize();
	int radius;
	if (!PyArg_ParseTuple(args, "i", &radius))
		return NULL;

	struct item *head = NULL;
	head = getAnglesList(radius, head);
	int numangles = list_length(head);

	npy_intp outdims[1] = {numangles};

	import_array(); // this is required to use PyArray_New() and PyArray_SimpleNew()
	PyArrayObject *output;
	output = (PyArrayObject *) PyArray_SimpleNew(1, outdims, NPY_DOUBLE);

	struct item *current;
	int i=0;
	for(current=head; current!=NULL; current=current->next) {
		*(double *) PyArray_GETPTR1(output, i) = current->angle;
		i++;
	}
	delete_list(head);

	return PyArray_Return(output);
}
コード例 #14
0
ファイル: flow_table.c プロジェクト: kazuyas/trema-edge
OFDPE
delete_flow_entries_by_group_id( const uint32_t group_id ) {
  assert( valid_group_id( group_id ) );

  if ( !lock_pipeline() ) {
    return ERROR_LOCK;
  }

  list_element *delete_us = NULL;
  create_list( &delete_us );

  for ( uint8_t table_id = 0; table_id <= FLOW_TABLE_ID_MAX; table_id++ ) {
    flow_table *table = get_flow_table( table_id );
    assert( table != NULL );
    for ( list_element *e = table->entries; e != NULL; e = e->next ) {
      assert( e->data != NULL );
      flow_entry *entry = e->data;
      if ( instructions_have_output_group( entry->instructions, group_id ) ) {
        append_to_tail( &delete_us, e->data );
      }
    }
  }

  delete_flow_entries_in_list( delete_us, 0, 0, OFPP_ANY, OFPG_ANY, OFPRR_GROUP_DELETE );

  if ( delete_us != NULL ) {
    delete_list( delete_us );
  }

  if ( !unlock_pipeline() ) {
    return ERROR_UNLOCK;
  }

  return OFDPE_SUCCESS;
}
コード例 #15
0
ファイル: flow_table.c プロジェクト: kazuyas/trema-edge
OFDPE
finalize_flow_table( const uint8_t table_id ) {
  if ( !valid_table_id( table_id ) ) {
    error( "Invalid flow table id ( %#x ).", table_id );
    return OFDPE_FAILED;
  }

  flow_table *table = get_flow_table( table_id );
  if ( table == NULL ) {
    return OFDPE_FAILED;
  }

  delete_timer_event_safe( age_flow_entries, &table->features.table_id );

  for ( list_element *e = table->entries; e != NULL; e = e->next ) {
    flow_entry *entry = e->data;
    if ( entry != NULL ) {
      free_flow_entry( entry );
    }
  }
  delete_list( table->entries );

  memset( table, 0, sizeof( flow_table ) );
  table->initialized = false;
  
  return OFDPE_SUCCESS;
}
コード例 #16
0
ファイル: simplex.c プロジェクト: Clover27/dewall-omp
int update_face(face *f, face_list *AFL) {
  if (member_list(AFL, f)){
    return delete_list(AFL, f);     
  }
  else 
    return insert_list(AFL, f);
}
コード例 #17
0
int main(int argc ,char** argv)
{
	int a[20]= {1,2,3,4,5,6,7,8,9,10,11,12,13};
	int i=0;
	list L;
	L = init_list();

	print(L);
	printf("insert node\n");
	for(i=0;i<13;i++)
	{
		insert_node( L,a[i]);
	}
	print( L);
	
	position mid = GetMidEle(L);
	printf("mid elemenet is %d \n",mid->data);
	
	printf("delete node\n");
	position P;
	P = find_value( L, 5);
	delete_node( L,P);
	print( L);
	printf("find node and insert node\n");
	P = find_value( L, 2);
	insert_node( P,111);
	print( L); 
	
	delete_list( L);
	print( L);
	
}
コード例 #18
0
int delete_file(union directory_entry *file_ptr, unsigned int directory_clus, unsigned int entry_num) {
	union directory_entry next_file;
	struct list *clusters;
	struct node *clus_node;
	unsigned int file_clus;
	clusters = create_list();
	file_clus = get_file_cluster(file_ptr);
	do {
		clusters->add(clusters, file_clus, "r");
		file_clus = get_next_cluster_in_fat(file_clus);
	} while (!end_of_chain(file_clus));
	
	while (!clusters->empty(clusters)) {
		clus_node = clusters->get_head(clusters);
		delete_cluster(clus_node->fst_file_clus);
		clusters->remove(clusters, clus_node->fst_file_clus);
	}

	get_next_directory_entry(&next_file, directory_clus, entry_num);
	if (next_file.raw_bytes[0] == 0x00) {
		file_ptr->raw_bytes[0] = 0x00;
	} else {
		file_ptr->raw_bytes[0] = 0xE5;
	}
	delete_list(clusters);
	set_directory_entry(file_ptr, directory_clus, entry_num);
	return 1;
}
コード例 #19
0
void delete_list(struct Entry *temp)
{
	if (temp != NULL) {
		delete_list(temp->next);
		free(temp);
	}
}
コード例 #20
0
ファイル: thread.c プロジェクト: Rafe/CuRT
err_t thread_suspend(tid_t tid)
{
	cpu_sr_t cpu_sr;
	thread_struct *pthread;

	if (tid < IDLE_THREAD_TID || tid > MAX_THREAD)
		return RET_ERR;

	if (thread_table[tid] == NULL)
		return RET_ERR;

	cpu_sr = save_cpu_sr();
	pthread = thread_table[tid];
	if (current_thread->tid == tid) {
		pthread->state = BLOCK;
		insert_back_list(&blocked_list, &pthread->node);
		restore_cpu_sr(cpu_sr);
		schedule(SCHED_THREAD_REQUEST);
		return RET_NO_ERR;
	}
	else if (pthread->prio > current_thread->prio &&
	         pthread->state == READY) {
		pthread->state = BLOCK;
		delete_list(&pthread->node);
		insert_back_list(&blocked_list, &pthread->node);
		restore_cpu_sr(cpu_sr);
		schedule(SCHED_THREAD_REQUEST);
		return RET_NO_ERR;
	}
	restore_cpu_sr(cpu_sr);
	return RET_ERR;
}
コード例 #21
0
ファイル: thread.c プロジェクト: Rafe/CuRT
err_t thread_resume(tid_t tid)
{
	cpu_sr_t cpu_sr;
	thread_struct *pthread;

	if (tid < IDLE_THREAD_TID || tid > MAX_THREAD)
		return RET_ERR;

	if (thread_table[tid] == NULL)
		return RET_ERR;

	cpu_sr = save_cpu_sr();
	pthread = thread_table[tid];
	if (pthread->state == BLOCK) {
		pthread->state = READY;
		delete_list(&pthread->node);
		insert_back_list(&ready_list[pthread->prio], &pthread->node);
		prio_exist_flag[pthread->prio] = true;
		restore_cpu_sr(cpu_sr);
		schedule(SCHED_THREAD_REQUEST);
		return RET_NO_ERR;
	}
	restore_cpu_sr(cpu_sr);
	return RET_ERR;
}
コード例 #22
0
ファイル: death.cpp プロジェクト: thefightingferret/tfe-1.0
void raw_kill( char_data* victim )
{
  affect_data    affect;
 
  victim->From( );

  remove_affect( victim );
  remove_leech( victim );

  victim->position  = POS_RESTING;
  victim->hit       = max( 1, victim->hit  );
  victim->mana      = max( 1, victim->mana );
  victim->move      = max( 1, victim->move );

  affect.type      = AFF_DEATH;
  affect.duration  = 20;
  affect.level     = 10;
  affect.leech     = NULL;

  add_affect( victim, &affect );
  delete_list( victim->prepare );
  update_maxes( victim );

  victim->To( get_room_index( ROOM_DEATH, FALSE ) );

  dismount( victim );
  clear_enemies( victim );

  write( player( victim ) );
}
コード例 #23
0
/**
 * Delete a game node
 *
 * @param root a game tree root
 */
void delete_game_node( struct GameNode ** root )
{
    if( *root == NULL )
        return;
    
    /* for each child */
    if( (*root)->children != NULL )
    {
        struct ListNode * current = (*root)->children->head;
        struct ListNode * temp;
        while( current != NULL )
        {
            struct GameNode * temp_node = current->data;
            Free( temp_node->state, sizeof( struct State ) );
            Free( temp_node->best_move, sizeof( struct Move ) );

            delete_game_node( &temp_node );

            //temp = current;
            current = current->next;

            //Free( temp, sizeof( struct ListNode ) );
        }
        delete_list( &(*root)->children );
    }
    
    Free( *root, sizeof( struct GameNode ) );
    *root = NULL;
}
コード例 #24
0
ファイル: symbol_table.c プロジェクト: msrojas/PythonC
void * ht_remove(uint8_t * key)
{
	unsigned int h = ht_calc_hash(key) % hash->size;
	hash_elem_t * e = hash->table[h];
	hash_elem_t * prev = NULL;

	while(e != NULL)
	{
		if(strcmp(e->var_name, key) == 0)
		{
			void * data = e->var_name;

			if(prev != NULL)
				prev->next = e->next;
			else
				hash->table[h] = e->next;
			if(e->value != NULL)
			    free(e->value);
            if(e->token == LIST)
            {
                delete_list(e->tokens->next);
                free(e->tokens);
            }
			free(e);
			e = NULL;
			return data;
		}
		prev = e;
		e = e->next;
	}

	return 0;

}
コード例 #25
0
ファイル: itemized_file_test.c プロジェクト: bncastle/itemize
int main(int argc, char **argv)
{
	ItemizerHeader *phdr;
	FILE *fin = fopen("items.bin", "rb");
	int sz = file_size(fin);
	char *data = (char *) malloc(sz);
	int status = 0;
	ItemList list;

	//Grab the data
	//printf("Data Size: %d\n", sz);
	fread(data, 1, sz, fin);
	fclose(fin);

	status = get_itemizer_header(&phdr, data);
	if(!status) printf("ERROR: INVALID file!\n");

	list = get_item_list(*phdr, data);

	Item *pitem = get_item("itemizer_c", list);

	if(pitem == NULL)
		printf("Unable to find item!\n");
	else
		printf("Found: %s\n", pitem->name);

	delete_list(list);
	free(data);
	return EXIT_SUCCESS;
}
コード例 #26
0
ファイル: edfile.c プロジェクト: jwongv/cmps012b
void editfile (list_ref list, char *filename) {
   char stdinline[1024];
   int stdincount = 0;
   for(;; ++stdincount) {
      printf ("%s: ", Exec_Name);
      char *linepos = fgets (stdinline, sizeof stdinline, stdin);
      if (linepos == NULL) break;
      if (want_echo) printf ("%s", stdinline);
      linepos = strchr (stdinline, '\n');
      if (linepos == NULL || stdinline[0] == '\0') {
         badline (stdincount, stdinline);
      }else {
         *linepos = '\0';
         switch (stdinline[0]) {
            case '$': setmove_list(list, MOVE_LAST, stdinline); break;
            case '*': print_all(list, stdinline); break;
            case '.': viewcurr_list(list, stdinline); break;
            case '0': setmove_list(list, MOVE_HEAD, stdinline); break;
            case '<': setmove_list(list, MOVE_PREV, stdinline); break;
            case '>': setmove_list(list, MOVE_NEXT, stdinline); break;
            case '@': debugdump_list (list, stdinline); break;
            case 'a': insert_line_after (list, stdinline+1); break;
            case 'd': delete_list(list, stdinline); break;
            case 'i': insert_line_before(list, stdinline+1); break;
            case 'r': insertfile(list, stdinline+1); break;
            case 'w': writefile (list, stdinline+1, filename); break;
            default : badline (stdincount, stdinline);
         }
      }
   }
   printf("%s\n", "^D");
}
コード例 #27
0
ファイル: flow_table.c プロジェクト: kazuyas/trema-edge
OFDPE
delete_flow_entries( const uint8_t table_id, const match *match, const uint64_t cookie, const uint64_t cookie_mask,
                     uint32_t out_port, uint32_t out_group ) {
  if ( !valid_table_id( table_id ) && table_id != FLOW_TABLE_ALL ) {
    return ERROR_OFDPE_FLOW_MOD_FAILED_BAD_TABLE_ID;
  }

  if ( !lock_pipeline() ) {
    return ERROR_LOCK;
  }

  list_element *delete_us = NULL;
  if ( table_id != FLOW_TABLE_ALL ) {
    delete_us = lookup_flow_entries_with_table_id( table_id, match, 0, false, false );
  }
  else {
    delete_us = lookup_flow_entries_from_all_tables( match, 0, false, false );
  }

  delete_flow_entries_in_list( delete_us, cookie, cookie_mask, out_port, out_group, OFPRR_DELETE );

  if ( delete_us != NULL ) {
    delete_list( delete_us );
  }

  if ( !unlock_pipeline() ) {
    return ERROR_UNLOCK;
  }

  return OFDPE_SUCCESS;
}
コード例 #28
0
void
print_with_csv_format( void *param, size_t entries, const topology_link_status *s ) {
  size_t i;

  UNUSED( param );

  debug( "topology: entries %zu", entries );

  list_element *link;
  create_list( &link );

  for ( i = 0; i < entries; i++ ) {
    insert_data( &link, &s[ i ] );
  }

  printf( "f-dpid,f-port,t-dpid,t-port,stat\n" );
  list_element *element;
  for ( element = link; element != NULL; element = element->next ) {
    print_link_status( element->data );
  }

  delete_list( link );

  stop_trema();
}
コード例 #29
0
ファイル: self_reverse.c プロジェクト: kaeruko/plactis
int main(int argc, char *argv[])
{
    struct list *head;

    char name[10];

    int i ;
    int count = 3;
    int num = 0;

    head = NULL;

    for (i = 0; i < count; ++i)
    {
        scanf("%s", name);
        head = add(head, name);
    }
    // show_target(head, num);
    // insert(head, num);
    delete_list(head, num);
    show(head);
    free(head);

    return 0;
}
コード例 #30
0
ファイル: test.c プロジェクト: suibian2k/TEST
int main(int argc, const char *argv[])
{
    NODE_T *head = NULL;    
    NODE_T *mp = NULL;
    int key = 4;

    while(1) 
    {
        mp = getNode();
        head = insert_list(head, mp);
        trav_list(head);
        mp = find_list(head, key);
        if(mp) 
        {
            print_node(mp);
            head = delete_list(head, mp);
        }
        else
        {
            printf("no age %d\n", key);
        }
    }
    return 0;
    //sdf
}