Example #1
0
/* add a gid to the list of gids */
void add_gid(gid_t gid)
{
	struct idlist *list = gidlist;
	char *name;

	if (numeric_ids) return;

	/* don't map root */
	if (gid==0) return;

	if (!list) {
		if (!(name = gid_to_name(gid))) return;
		gidlist = add_list((int)gid, name);
		return;
	}

	while (list->next) {
		if (list->id == (int)gid) return;
		list = list->next;
	}

	if (list->id == (int)gid) return;

	if (!(name = gid_to_name(gid))) return;

	list->next = add_list((int)gid, name);
}
Example #2
0
void check_filebox(char *boxpath, file_list **st)
{
    char	    *temp;
    DIR             *dp;
    struct dirent   *de;
    struct passwd   *pw;
    struct stat     stbuf;

    if ((dp = opendir(boxpath)) == NULL) {
	Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(boxpath));
    } else {
	Syslog('o', "checking filebox \"%s\"", boxpath);
        temp = calloc(PATH_MAX, sizeof(char));
	pw = getpwnam((char *)"mbse");
        while ((de = readdir(dp))) {
            if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
		snprintf(temp, PATH_MAX -1, "%s/%s", boxpath, de->d_name);
                if (stat(temp, &stbuf) == 0) {
                    Syslog('o' ,"checking file \"%s\"", de->d_name);
                    if (S_ISREG(stbuf.st_mode)) {
                        if (pw->pw_uid == stbuf.st_uid) {
                            /*
                             * We own the file
                             */
                            if ((stbuf.st_mode & S_IRUSR) && (stbuf.st_mode & S_IWUSR)) {
                                add_list(st, temp, de->d_name, KFS, 0L, NULL, 1);
                            } else {
                                Syslog('+', "No R/W permission on %s", temp);
                            }
                        } else if (pw->pw_gid == stbuf.st_gid) {
                            /*
                             * We own the file group
                             */
                            if ((stbuf.st_mode & S_IRGRP) && (stbuf.st_mode & S_IWGRP)) {
                                add_list(st, temp, de->d_name, KFS, 0L, NULL, 1);
                            } else {
                                Syslog('+', "No R/W permission on %s", temp);
                            }
                        } else {
                            /*
                             * No owner of file
                             */
                            if ((stbuf.st_mode & S_IROTH) && (stbuf.st_mode & S_IWOTH)) {
                                add_list(st, temp, de->d_name, KFS, 0L, NULL, 1);
                            } else {
                                Syslog('+', "No R/W permission on %s", temp);
                            }
                        }
                    } else {
                        Syslog('+', "Not a regular file %s", temp);
                    }
                } else {
                    WriteError("Can't stat %s", temp);
                }
            }
	}
	closedir(dp);
	free(temp);
    }
}
Example #3
0
List * tag_list()
{
	List * list = NULL;

	if( match( STAG ) )
	{
		list = make_list( yylval );	//匹配到开始标签
		advance();
		add_child( list, tag_list() ); //添加孩子
		if( strcmp( yylval->tag_name, list->node->tag_name ) != 0 )	//处理标签不匹配问题
		{
			printf( "发生标签不匹配问题,在.xml文件中%d行的%s标签与在%d行%s标签不匹配!\n", 
				yylval->lineno, yylval->tag_name, list->node->lineno, list->node->tag_name );
			exit( 0 );
		}
		advance();
		add_list( list, tag_list() );	//添加同级标签
	}
	else if( match( TEXT ) )
	{
		list = make_list( yylval );
		advance();
		add_list( list, tag_list() );
	}
	else if( match( ETAG ) )	//匹配到结束标签 直接返回空
		;
	return list;
}
Example #4
0
list_t* find_and_report(const char* datafile, const char mode, int pkgc, list_t* argv)
{
	// set quiet to avoid print results of search_record()
	unsigned short int hold_quiet=quiet;
	quiet = 1;

	int i=0;
	int found = 0;
	unsigned short int fcount = 0;
	unsigned short int mcount = 0;
	
	list_t* founded = new_list(0);
	list_t* missing = new_list(0);
	
	for (i=0; i<pkgc; i++)
	{	
		char* pkg  = get_list(argv,i);
		char buf[1024];
		strcpy(buf, pkg);
		
		char* tk = strtok(buf, "|");
		while(tk != NULL)
		{
			found = 0;
			if(search_record(datafile, tk))
			{
				found = 1;
				break;
			}
			tk = strtok(NULL, " ,");
		}
	
		if(found == 1)
		{
			fcount = fcount+1;
			resize_list(founded,fcount);
			add_list(founded,fcount-1,tk);
		} else {
			mcount = mcount+1;
			resize_list(missing,mcount);
			add_list(missing,mcount-1,pkg);
		}
	}
	quiet = hold_quiet;
	
	switch(mode)
	{
		case 'f' :
			return(founded);
		case 'm' :
			return(missing);
	}
	
	destroy_list(founded);
	destroy_list(missing);
	return(NULL);
}
Example #5
0
void add_map(Map* map, const void* key, int keylen, void* item)
{
	assert(0 == find_map(map, key, keylen));
	Key* new_key = alloc_resource(sizeof(Key) + keylen);
	memcpy(new_key->data, key, keylen);
	new_key->keylen = keylen;

	add_list(map->key_list, new_key);
	add_list(map->val_list, item);
}
Example #6
0
void check_keys (void)
{
LONG state;
LONG key;
int count;
int tmpangle;
if (game_status != GAME_PLAYING || input_enabled == FALSE)
	 return;
// this routine checks the keys async.
key = 0x63; //VK_LEFT;
state = WinGetPhysKeyState (HWND_DESKTOP,key);
if (state & 0x8000)  // key is down
	  ship->angle += game_turning;
key = 0x64; // VK_RIGHT
state = WinGetPhysKeyState (HWND_DESKTOP,key);
if (state & 0x8000)
	 ship->angle -= game_turning;
key = 0x61; // VK_UP
state = WinGetPhysKeyState (HWND_DESKTOP,key); // increase thrust
if (state & 0x8000)
	{
	 thrust_objekt(ship,THRUSTPOWER);
	 // now insert some thrust pixels in the OBJEKT llist
	 for (count = 0; count < maxthrustpixels; count++)
			 {
			 tmpangle = (ship->angle)+180+random(40)-20;
			 add_list(init_objekt(OT_THRUST,ship->current.x,ship->current.y, tmpangle, random(10)+MAXTHRUST, DT_PIXEL, random(4)+3, CLR_WHITE, pixeldata, 1),effekts);
		 }
	}
key = 0x39; // VK_SPACE
state = WinGetPhysKeyState (HWND_DESKTOP,key); //shoot
if (state & 0x8000)
	{
	if (game_shooting == 0)  // ok you can shoot
		{
		if (game_shots == 1)
			{
				 add_list(init_objekt(OT_SHOT,ship->real[0].x,ship->real[0].y, ship -> angle, MAXTHRUST+12, DT_LINE, game_shotlife,CLR_PINK, shotdata, 2),shots);
				 thrust_objekt(ship,-THRUSTPOWER);
				 }
			else
          {
          add_list(init_objekt(OT_SHOT,ship->real[0].x,ship->real[0].y, ship -> angle-3, MAXTHRUST+12, DT_LINE, game_shotlife,CLR_PINK, shotdata, 2),shots);
          add_list(init_objekt(OT_SHOT,ship->real[0].x,ship->real[0].y, ship -> angle+3, MAXTHRUST+12, DT_LINE, game_shotlife,CLR_PINK, shotdata, 2),shots);
          thrust_objekt(ship,-THRUSTPOWER*2);
          }
      if (game_rearshot)
          {
          add_list(init_objekt(OT_SHOT,ship->real[2].x,ship->real[2].y, ship -> angle+180, MAXTHRUST+12, DT_LINE, game_shotlife,CLR_PINK, shotdata, 2),shots);
          thrust_objekt(ship,THRUSTPOWER);
          }
      game_shooting = game_maxshots;
      }
   }
}
Example #7
0
cons_t *create_list(Token *token)
{
	cons_t *list = NULL;
	consvalue_t value;
	value.i = 0;

	while(next_token(token)){
		switch(token->type){
		case TOKEN_BRACE_OPEN:
			value.car = create_list(token);
			list = add_list(list, TYPE_CAR, value);
			break;

		case TOKEN_INT:
			value.i = token->num;
			list = add_list(list, TYPE_INT, value);
			break;

		case TOKEN_STR:
			if(strcmp(token->str, "if") == 0){
				list = add_list(list, TYPE_IF, value);
			}else if(strcmp(token->str, "t") == 0){
				list = add_list(list, TYPE_T, value);
			}else if(strcmp(token->str, "nil") == 0){
				list = add_list(list, TYPE_NIL, value);
			}else if(strcmp(token->str, "setq") == 0){
				list = add_list(list, TYPE_SETQ, value);
			}else if(strcmp(token->str, "defun") == 0){
				list = add_list(list, TYPE_DEFUN, value);
			}else{
				// variable or function ?
				int length = strlen(token->str);
				value.str = (char *)low_malloc(length+1);
				strcpy(value.str, token->str);
				list = add_list(list, TYPE_STR, value);
			}
			break;

		case TOKEN_OPERATE:
			list = add_list(list, token->num, value);
			break;

		case TOKEN_BRACE_CLOSE:
			goto end;

		default:
			printf("PARSER ERROR!!\n");
			goto end;
		}
	}
end:
	return list;
}
NODE * add_list(NODE *l1, NODE *l2, int carry)
{
	int result = 0;
	if (carry && l1 == NULL && l2 == NULL) {
		NODE * newnode = (NODE *) malloc(sizeof(NODE));
		newnode->data = carry;
		newnode->next = NULL;
		return newnode;
	} else if (l1 == NULL && l2 == NULL) {
		return NULL;
	}

	if (l1 != NULL)
		result = result + l1->data;

	if (l2 != NULL)
		result = result + l2->data;
	
	result = result + carry;

	if (result >= 10) carry = 1;
	else carry = 0;

	result = result % 10;

	NODE * newnode = (NODE *) malloc (sizeof(NODE));
	newnode->data = result;
	newnode->next = add_list(l1->next ? l1->next : NULL,
							 l2->next ? l2->next : NULL, 
							 carry);

	return newnode;
}
Example #9
0
		DefaultLayout()
		{
			add_simple(_T("A"),&CPipeDataSBase::m_a);
			add_simple(_T("C"),&CPipeDataSBase::m_c);
			add_simple(_T("StrBase"),&CPipeDataSBase::m_strbase);
			add_list(_T("StringsList"),&CPipeDataSBase::m_strlist,get_primitivelayout<CString>());
		}
Example #10
0
void main()
{
	puts("linked list start");

	linked_list *node;

	node = NULL;

	add_list(&node, "list1");
	add_list(&node, "list2");
	add_list(&node, "list3");

	remove_list(&node);

	print_list(node);
}
Example #11
0
/**
 * \brief XMLParser::setProjectRoot, converti et defini les attributs
 * du document (pugi::xml_document) depuis un projet
 * \param p : Project*, le projet a definir
 * \param root_tag : const char*, le nom de la balise racine
 */
void XMLParser::setListRoot(Liste *p, const char* root_tag)
{
	pugi::xml_node k;			/* Key for node */
	const char* tmp;			/* Value of key */
	this->doc=new pugi::xml_document();
	pugi::xml_node node = doc->append_child(root_tag);
	node.append_attribute("id")=(unsigned int)p->getId();
	// Title
	k = node.append_child(KEY_TAG);
	tmp = p->getTitle().c_str();
	k.append_child(pugi::node_pcdata).set_value(tmp);
	k.append_attribute("name")="title";
	// Date
	k = node.append_child(KEY_TAG);
	tmp = p->getDate().c_str();
	k.append_child(pugi::node_pcdata).set_value(tmp);
	k.append_attribute("name")="date";
	// isChecked
	k = node.append_child(KEY_TAG);
	k.append_child(pugi::node_pcdata).set_value(p->isDoneChecked()?"true":"false");
	k.append_attribute("name")="isChecked";
	// isOrdered
	k = node.append_child(KEY_TAG);
	k.append_child(pugi::node_pcdata).set_value(p->isOrderedList()?"true":"false");
	k.append_attribute("name")="isOrdered";	
	// deep
	k = node.append_child(KEY_TAG);
	unsigned int deepvalue = p->getDeep();
	std::stringstream deepss;
	deepss << deepvalue;
	k.append_child(pugi::node_pcdata).set_value(deepss.str().c_str());
	k.append_attribute("name")="deep";
			
	add_list(p->getElements(),node);
}
Example #12
0
File: i512_2.c Project: chocht/2048
int			algo(t_data *data)
{
  if (data->key_func[data->index])
    data->key_func[data->index](data->key);
  if (play(data->grid, data->key) == 0)
    {
      data->key = -1;
      return (0);
    }
  del_rest_of_the_list(data);
  if (add_list(&data->list, data->grid))
    return (1);
  data->current = data->current->next;
  add_random(data->grid);
  blit_this(data);
  if (is_win(data->grid))
    {
      data->play = 0;
      return (0);
    }
  else if (is_lost(data->grid))
    {
      data->play = 0;
      return (0);
    }
  data->key = -1;
  return (0);
}
Example #13
0
/*
 * Create file request list for the Hydra or Binkp protocol.
 */
file_list *create_freqlist(fa_list *al)
{
    file_list	*st = NULL, *tmpf;
    fa_list	*tmpa;
    char	*nm, tmpreq[13];
    struct stat	stbuf;

    Syslog('o', "create_freqlist(%s)", al?ascfnode(al->addr, 0x1f):"<none>");
    made_request = 0;

    for (tmpa = al; tmpa; tmpa = tmpa->next) {
	nm = reqname(tmpa->addr);
	if ((nm != NULL) && (stat(nm, &stbuf) == 0)) {
	    snprintf(tmpreq, 13, "%04X%04X.REQ", tmpa->addr->net, tmpa->addr->node);
	    add_list(&st, nm, tmpreq, DSF, 0L, NULL, 1);
	    made_request = 1;
	}
    }

    if (made_request) {
	for (tmpf = st; tmpf; tmpf = tmpf->next)
	    Syslog('o', "flist: \"%s\" -> \"%s\" dsp:%d flofp:%lu floff:%lu",
			MBSE_SS(tmpf->local), MBSE_SS(tmpf->remote), tmpf->disposition, tmpf->flofp, tmpf->floff);
    }

    return st;
}
Example #14
0
t_str	*add_str(t_str *begin, char *str, char c)
{
	int i;
	t_str *list;

	i = 0;
	if (!begin)
		begin = add_list(NULL);
	list = begin;
	while (list->next)
		list = list->next;

	if (str)
	{
		while (str[i])
		{
			if (list->index < 32)
			{
				list->str[list->index] = str[i];
				list->index++;
				i++;
			}
			else
			{
				list->next = add_list(begin);
				list = list->next;
			}
		}
	}
	else if (c)
	{
		if (list->index < 32)
		{
			list->str[list->index] = c;
			list->index++;
		}
		else
		{
			list->next = add_list(begin);
			list = list->next;
			list->str[list->index] = c;
			list->index++;
		}
	}
	return (begin);
}
Example #15
0
static void expand_copy_info(copy_info *list)
{
	copy_info	*bi;

	for (bi = list; bi->src_fmt != -1; bi++)
	{
		if (bi->bm_mask == BM_ALL)
		{
			add_list(&blit_info[bi->src_fmt], bi, SDL_BLENDMODE_NONE);
			add_list(&blit_info[bi->src_fmt], bi, SDL_BLENDMODE_ADD);
			add_list(&blit_info[bi->src_fmt], bi, SDL_BLENDMODE_MOD);
			add_list(&blit_info[bi->src_fmt], bi, SDL_BLENDMODE_BLEND);
		}
		else
			add_list(&blit_info[bi->src_fmt], bi, bi->bm_mask);
	}
}
Example #16
0
void renderer_sdl2::expand_copy_info(const copy_info_t *list)
{
	for (const copy_info_t *bi = list; bi->src_fmt != -1; bi++)
	{
		if (bi->bm_mask == BM_ALL)
		{
			add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_NONE);
			add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_ADD);
			add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_MOD);
			add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_BLEND);
		}
		else
		{
			add_list(&s_blit_info[bi->src_fmt], bi, bi->bm_mask);
		}
	}
}
int stored_obj(struct mem_obj *obj)
{
//	printf("stored obj now\n");
    struct mem_obj *tmp_obj=NULL;
    int found=0;
    if(obj==NULL)
        return 0;
    if(obj->flags & (FLAG_DEAD)) {
        destroy_obj(obj,0);
        //	printf("obj have set dead \n");
        //	obj=NULL;
        return -1;
    }
//	obj->last_access=time(NULL);
//	printf("obj->times.last_modified=%d %s:%d\n",obj->times.last_modified,__FILE__,__LINE__);

    obj->m_list.obj=(void *)obj;
    obj->prev=NULL;
    obj->resident_size =obj->content_length;//calculate_resident_size(obj);
    u_short url_hash=T_hash(&obj->url);
    LOCK_OBJ_LIST
    pthread_mutex_lock(&hash_table[url_hash].lock);
    tmp_obj=hash_table[url_hash].next;
    while(tmp_obj) {
        if ( (tmp_obj->url.port==obj->url.port) &&
                !strcmp(tmp_obj->url.path, obj->url.path) &&
                !strcasecmp(tmp_obj->url.host, obj->url.host) &&
                !strcasecmp(tmp_obj->url.proto, obj->url.proto) &&
                !(tmp_obj->flags & FLAG_DEAD) ) {
            found=1;
            break;
        }
        tmp_obj=tmp_obj->next;
    }
    if(found) {
        pthread_mutex_unlock(&hash_table[url_hash].lock);
        UNLOCK_OBJ_LIST
        destroy_obj(obj,0);
        //	printf("have another obj in\n");
        return 0;
    }

    obj->next=hash_table[url_hash].next;
    if (obj->next) obj->next->prev = obj;
    hash_table[url_hash].next=obj;
    obj->hash_back = &hash_table[url_hash];
    if(TEST(obj->flags,FLAG_IN_MEM)) {
        increase_hash_size(obj->hash_back, obj->resident_size);
    }
    if(TEST(obj->flags,FLAG_IN_DISK)) {
        increase_hash_size(obj->hash_back, obj->resident_size,false);
    }
    add_list(&obj->m_list);
    pthread_mutex_unlock(&hash_table[url_hash].lock);
    UNLOCK_OBJ_LIST
    return 1;
};
Example #18
0
/* tree_to_list: in-order print of tree p */
void tree_to_list(struct tnode *p)
{
  if (p != NULL) {
    tree_to_list(p->left);
    //printf("%4d %s\n", p->count, p->word);
    add_list(p);
    tree_to_list(p->right);
  }
}
Example #19
0
void
add_time_list(wchar_t *wcs)
{
	char *str;

	if ((str = to_mb_string(wcs)) == NULL) {
		INTERR;
		return;
	}
	free(wcs);

	switch (last_kw) {
	case T_ABMON:
		add_list(tm.mon, str, 12);
		break;
	case T_MON:
		add_list(tm.month, str, 12);
		break;
	case T_ABDAY:
		add_list(tm.wday, str, 7);
		break;
	case T_DAY:
		add_list(tm.weekday, str, 7);
		break;
	case T_AM_PM:
		if (tm.am == NULL) {
			tm.am = str;
		} else if (tm.pm == NULL) {
			tm.pm = str;
		} else {
			fprintf(stderr,"too many list elements");
			free(str);
		}
		break;
	case T_ALT_DIGITS:
	case T_ERA:
		free(str);
		break;
	default:
		free(str);
		INTERR;
		break;
	}
}
Example #20
0
int main(int argc, char **argv)
{
	FILE *fin, *fout;
	char buf[1024];
	int ret, i, count;
	struct block_list *list2;
	struct stat st;

	fin = fopen(argv[1], "r");
	fout = fopen(argv[2], "w");
	if (!fin || !fout) {
		printf("Usage: ./program <input> <output>\n");
		perror("open: ");
		exit(2);
	}

	fstat(fileno(fin), &st);
	max_size = st.st_size / 100; /* hack ... */

	list = malloc(max_size * sizeof(*list));

	for(;;) {
		ret = read_block(buf, fin);
		if (ret < 0)
			break;

		buf[ret] = '\0';
		add_list(buf, ret);
	}

	printf("loaded %d\n", list_size);

	printf("sorting ....\n");

	qsort(list, list_size, sizeof(list[0]), compare_txt);

	list2 = malloc(sizeof(*list) * list_size);

	printf("culling\n");

	for (i=count=0;i<list_size;i++) {
		if (count == 0 ||
		    strcmp(list2[count-1].txt, list[i].txt) != 0) {
			list2[count++] = list[i];
		} else {
			list2[count-1].num += list[i].num;
		}
	}

	qsort(list2, count, sizeof(list[0]), compare_num);

	for (i=0;i<count;i++) {
		fprintf(fout, "%d times:\n%s\n", list2[i].num, list2[i].txt);
	}
	return 0;
}
Example #21
0
//
// build_img_list
// Prend en argument la matrice contenant les labels,
// sa taille et la liste chaînée contenant les labels.
// Ne renvoi rien
//
void build_img_list(t_pixel **img_label_matrix, t_plist *img_label_list, uint32_t nl, uint32_t nc){
	int i,j;	
	for(i=1;i<nl-1;i++){
		for(j=1;j<nc-1;j++){
			if(img_label_matrix[i][j].obj.border==2){
				(*img_label_list)=add_list(img_label_matrix[i][j], *img_label_list);
			}
		}					
	}
}
Example #22
0
void insert_explosion (POINTL at, int nbr_pixels)
{
int tmpangle;
int count;
for (count = 0; count < nbr_pixels; count++)
	{
  tmpangle = random(360);
  add_list(init_objekt(OT_THRUST,at.x,at.y, tmpangle, random(10)+5, DT_PIXEL, 15, CLR_WHITE, pixeldata, 1),effekts);
	}
}
Example #23
0
File: list.c Project: joxer/works
int main(){

  struct list l1, *l2, *l3, *l22;
  l22 = list_c();
  l22->value= 56;

  
  l1.value = 3; 
  l2 = add_list(&l1, 4);
  l3 = add_list(l2, 5);
  list_a_p(l22, l3);
    list_a_n(l22, &l1);
  
  search(&l1, 4);
  
  show_all(l22);

  return 0;
}
Example #24
0
void insert_shipexplosion (POINTL at, int nbr_lines)
{
int tmpangle;
int count;

for (count = 0; count < nbr_lines; count++)
  {
  tmpangle = random(360);
	add_list(init_objekt(OT_LINE,at.x,at.y, tmpangle, random(12)+5, DT_POLY, 30, CLR_YELLOW, linedata, 2),effekts);
  }
}
Example #25
0
int main(){
  llist* my_list=NULL;		/* Pointer to an empty list */
  int i=0;

  for (i=0;i<5;i++)           /* loop to build the list */
	 my_list = add_list(my_list,i,i, i*1.0f);   /* add an item to list */

  print_list(my_list);			
  my_list = clear_list(my_list);
  
}
Example #26
0
// remove environment variable(s) or aliases
int unset_cmd( int argc, char **argv )
{
    char *arg;
    int i, rval = 0;
    long fUnset;
    PCH pchList;

    // set the pointer to either the environment or the alias list
    if ( _stricmp( gpInternalName, UNSET_COMMAND ) == 0 )  {

        pchList = 0L;

    } else
        pchList = glpAliasList;

    // strip leading switches
    if (( GetSwitches( argv[1], "MQR", &fUnset, 1 ) != 0 ) || ( first_arg( argv[1] ) == NULL ))
        return ( usage(( pchList == glpAliasList ) ? UNALIAS_USAGE : UNSET_USAGE ));

    // check for master environment set
    if (( pchList == 0L ) && ( fUnset & UNSET_MASTER ))
        pchList = glpMasterEnvironment;

    // read environment or alias file(s)
    if ( fUnset & UNSET_READ )
        return ( SetFromFile( argv[1], pchList, 1 ));

    for ( i = 0; (( arg = ntharg( argv[1], i )) != NULL ); i++ ) {

        if ( _stricmp( arg, "*" ) == 0 ) {

            // wildcard kill - null the environment or alias list
            if ( pchList == 0L )
                pchList = glpEnvironment;
            pchList[0] = '\0';
            pchList[1] = '\0';
            break;
        }

        // kill the variable or alias
        if ( get_list( arg, pchList ) == 0L ) {

            // check for "quiet" switch
            if ( fUnset & UNSET_QUIET )
                rval = ERROR_EXIT;
            else
                rval = error((( pchList == glpAliasList ) ? ERROR_4DOS_NOT_ALIAS : ERROR_4DOS_NOT_IN_ENVIRONMENT ), arg );

        } else if ( add_list( arg, pchList ) != 0)
            rval = ERROR_EXIT;
    }

    return rval;
}
Example #27
0
static int	case_add_list(t_list *list, int *flag, int *flag2)
{
  *flag2 = 0;
  if (*flag == 1)
    {
      *flag = 0;
      if (add_list(list) == -1)
	return (-1);
    }
  return (0);
}
Example #28
0
Node * add_list(Node * head, Node * newNode)
{//recursively adds a new node to the end of the linked list
	if (head == NULL)
	{
		head = newNode;
		return (head);
	}

	head -> next = add_list(head -> next, newNode);
	return (head);
}
Example #29
0
int main()
{
	struct node *list1;
	struct node *list2;
	push(&list1, 9);
	push(&list1, 9);
	push(&list1, 9);
	print_list(list1);
	push(&list2, 9);
	push(&list2, 9);
	push(&list2, 9);
	print_list(list2);
	struct node *sum = add_list(list1, list2);
	print_list(sum);
}
Example #30
0
void build_rpc(void *arg)
{
    char *ip_addr = (char*)arg;
    
    CLIENT *cl;
    
    cl = clnt_create(ip_addr, MONITOR_PROG, MONITOR_VERS, "tcp");
    if (cl == NULL) {
        perror("clnt_create error");
        exit(0);
    }
    
    //add_task(&thread_pool, cl);
    add_list(head, cl);
}