Ejemplo n.º 1
0
void exe_rmdir(t_dir* lroot, char* name){
	int i;
	
	p_node *currentChild;
	t_dir *cd;
	if (lroot->GDir == NULL)
		return;
	
	currentChild = lroot->GDir->head;
	cd = (t_dir*)currentChild->object;
	
	for (i=0; i < lroot->GDir->size; i++){
		if (!my_strcmp(cd->name, name)){
			if (cd->GDir->head != NULL){
				printf("\033[22;31m rmdir: failed to remove '%s': Directory not empty  \033[01;37m \n", name);
				return;
			}else{			
				p_remove(lroot->GDir, cd);
				return;
			}
		}
		currentChild = currentChild->next;
		cd = (t_dir*)currentChild->object;
	}	
	
}
Ejemplo n.º 2
0
//SUMMARY
// Return the first request in the queue after removing it from the queue, or NULL if the queue is empty
struct request* p_shift() {

	fprintf(stderr, "p_shift: Called\n");

	struct request* first = p_first();

	if (first != NULL)
		p_remove(first);

	return first;

}
int main()
{
	qu.front = -1;
	qu.rear = -1;
	
	add(3);
	add(4);
	add(56);
	add(5);
	add(8);
	add(10);
	add(11);

	display();
	
	int p;
	p = p_remove();
	printf("Item Removed : %d ", p);
	p = p_remove();
	printf("\nItem Removed : %d ", p);
	p = p_remove();
	printf("\nItem Removed : %d \n", p);
		
	display();

	add(43);
	add(99);
	add(89);

	display();
	
	p = p_remove();	
	printf("Item Removed : %d ", p);
	p = p_remove();
	printf("\nItem Removed : %d \n", p);

	display();	
	return 0;
}
Ejemplo n.º 4
0
void Y_remove(int nArgs)
{
  if (nArgs!=1) YError("remove takes exactly one argument");
  p_remove(YGetString(sp));
}