contrib/ed/u.c
/* This function does the "real work" of the undo.
 * It is separated out from u() so that the SIGHUP handling
 * routine can call it without dealing with rol(), in turn so that
 * the buffer is in a "good" state when saved to the 'ed.hup' file.
 */
This function does the "real work" of the undo.
It is separated out from u() so that the SIGHUP handling
routine can call it without dealing with rol(), in turn so that
the buffer is in a "good" state when saved to the 'ed.hup' file.
This function does the " real work " of the undo . It is separated out from u () so that the SIGHUP handling routine can call it without dealing with rol () in turn so that the buffer is in a " good " state when saved to the ' ed . hup ' file .
void
undo()
{
	LINE *l_current, *l_bottom, *l_top;
	struct u_layer *l_old_u_stk, *l_temp;
	struct d_layer *l_d_temp;
	sigspecial++;
	l_current = u_current;
	l_top = u_top;
	l_bottom = u_bottom;
	u_current = current;
	u_top = top;
	u_bottom = bottom;
	l_d_temp = old_d_stk;
	old_d_stk = d_stk;
	d_stk = l_d_temp;
	l_old_u_stk = u_stk;
	u_stk = NULL;
	while (l_old_u_stk != NULL) {
		u_add_stk(l_old_u_stk->cell);
		(*(l_old_u_stk->cell)) = (l_old_u_stk->val);
		l_temp = l_old_u_stk;
		l_old_u_stk = l_old_u_stk->below;
		free(l_temp);
	}
	current = l_current;
	top = l_top;
	bottom = l_bottom;
	sigspecial--;
	if (sigint_flag && (!sigspecial))
		SIGINT_ACTION;
}
void undo ( ) { LINE * l_current , * l_bottom , * l_top ; struct u_layer * l_old_u_stk , * l_temp ; struct d_layer * l_d_temp ; sigspecial ++ ; l_current = u_current ; l_top = u_top ; l_bottom = u_bottom ; u_current = current ; u_top = top ; u_bottom = bottom ; l_d_temp = old_d_stk ; old_d_stk = d_stk ; d_stk = l_d_temp ; l_old_u_stk = u_stk ; u_stk = NULL ; while ( l_old_u_stk != NULL ) { u_add_stk ( l_old_u_stk -> cell ) ; ( * ( l_old_u_stk -> cell ) ) = ( l_old_u_stk -> val ) ; l_temp = l_old_u_stk ; l_old_u_stk = l_old_u_stk -> below ; free ( l_temp ) ; } current = l_current ; top = l_top ; bottom = l_bottom ; sigspecial -- ; if ( sigint_flag && ( ! sigspecial ) ) SIGINT_ACTION ; }
This function does the "real work" of the undo.
This function does the " real work " of the undo .
/* This is done because undo can be undone. */