contrib/ed/u.c
/*
 * This function should be called before u_add_stk is in each command
 * function, _except_ when the global flag is high (>0) -- otherwise,
 * we couldn't undo all of the global commands, only the last iteration
 * of the last command -- and the u command.
 * This is where we begin to dispose of ed's undo knowledge of a line.
 * The call to d_do() gets rid of the rest.
 */
This function should be called before u_add_stk is in each command
function, _except_ when the global flag is high (>0) -- otherwise,
we couldn't undo all of the global commands, only the last iteration
of the last command -- and the u command.
This is where we begin to dispose of ed's undo knowledge of a line.
The call to d_do() gets rid of the rest.
This function should be called before u_add_stk is in each command function _except_ when the global flag is high ( > 0 ) -- otherwise we couldn ' t undo all of the global commands only the last iteration of the last command -- and the u command . This is where we begin to dispose of ed ' s undo knowledge of a line . The call to d_do () gets rid of the rest .
void
u_clr_stk()
{
	register struct u_layer *l_temp;
	u_current = current;
	u_top = top;
	u_bottom = bottom;
	sigspecial++;
	if ((u_stk) && (d_stk))
		d_do();
	while (u_stk != NULL) {
		l_temp = u_stk;
		u_stk = u_stk->below;
		free(l_temp);
	}
	u_stk = NULL;		
	old_d_stk = NULL; 	
	sigspecial--;
	if (sigint_flag && (!sigspecial))
		SIGINT_ACTION;
}
void u_clr_stk ( ) { register struct u_layer * l_temp ; u_current = current ; u_top = top ; u_bottom = bottom ; sigspecial ++ ; if ( ( u_stk ) && ( d_stk ) ) d_do ( ) ; while ( u_stk != NULL ) { l_temp = u_stk ; u_stk = u_stk -> below ; free ( l_temp ) ; } u_stk = NULL ; old_d_stk = NULL ; sigspecial -- ; if ( sigint_flag && ( ! sigspecial ) ) SIGINT_ACTION ; }
This function should be called before u_add_stk is in each command
 function, _except_ when the global flag is high (>0) -- otherwise,
 we couldn't undo all of the global commands, only the last iteration
 of the last command -- and the u command.
This function should be called before u_add_stk is in each command function _except_ when the global flag is high ( > 0 ) -- otherwise we couldn ' t undo all of the global commands only the last iteration of the last command -- and the u command .
/* Only if there is something to delete in the buffer. */ /* Just to sure. */ /* so something in use isn't freed! */