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.15 1993/12/22 13:15:47 bostic Exp $ (Berkeley) $Date: 1993/12/22 13:15:47 $";
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 CBEMPTY(sp
, cbp
, name
);
57 * If the buffer was cut in line mode or had portions of more
58 * than one line, <newlines> are appended to each line as it
59 * is pushed onto the stack.
61 tp
= cbp
->textq
.cqh_last
;
62 lmode
= F_ISSET(cbp
, CB_LMODE
) || tp
->q
.cqe_prev
!= (void *)&cbp
->textq
;
63 for (; tp
!= (void *)&cbp
->textq
; tp
= tp
->q
.cqe_prev
)
64 if ((lmode
|| tp
->q
.cqe_prev
!= (void *)&cbp
->textq
) &&
65 term_push(sp
, "\n", 1, 0, 0) ||
66 term_push(sp
, tp
->lb
, tp
->len
, 0, CH_QUOTED
))