2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
9 static char sccsid
[] = "$Id: ex_at.c,v 8.16 1994/01/09 14:20:53 bostic Exp $ (Berkeley) $Date: 1994/01/09 14:20:53 $";
12 #include <sys/types.h>
22 * ex_at -- :@[@ | buffer]
25 * Execute the contents of the buffer.
40 /* Historically, @@ and ** execute the last buffer. */
42 if (name
== cmdp
->cmd
->name
[0]) {
43 if (!exp
->at_lbuf_set
) {
44 msgq(sp
, M_ERR
, "No previous buffer to execute.");
50 CBNAME(sp
, cbp
, name
);
52 msgq(sp
, M_ERR
, "Buffer %s is empty.", charname(sp
, name
));
61 * If the buffer was cut in line mode or had portions of more
62 * than one line, <newlines> are appended to each line as it
63 * is pushed onto the stack.
65 tp
= cbp
->textq
.cqh_last
;
66 lmode
= F_ISSET(cbp
, CB_LMODE
) || tp
->q
.cqe_prev
!= (void *)&cbp
->textq
;
67 for (; tp
!= (void *)&cbp
->textq
; tp
= tp
->q
.cqe_prev
)
68 if ((lmode
|| tp
->q
.cqe_prev
!= (void *)&cbp
->textq
) &&
69 term_push(sp
, "\n", 1, 0, 0) ||
70 term_push(sp
, tp
->lb
, tp
->len
, 0, CH_QUOTED
))