xref: /openbsd/usr.bin/vi/ex/ex_yank.c (revision 486aa1f0)
1 /*	$OpenBSD: ex_yank.c,v 1.6 2014/11/12 04:28:41 bentley Exp $	*/
2 
3 /*-
4  * Copyright (c) 1992, 1993, 1994
5  *	The Regents of the University of California.  All rights reserved.
6  * Copyright (c) 1992, 1993, 1994, 1995, 1996
7  *	Keith Bostic.  All rights reserved.
8  *
9  * See the LICENSE file for redistribution information.
10  */
11 
12 #include "config.h"
13 
14 #include <sys/types.h>
15 #include <sys/queue.h>
16 
17 #include <bitstring.h>
18 #include <limits.h>
19 #include <stdio.h>
20 
21 #include "../common/common.h"
22 
23 /*
24  * ex_yank -- :[line [,line]] ya[nk] [buffer] [count]
25  *	Yank the lines into a buffer.
26  *
27  * PUBLIC: int ex_yank(SCR *, EXCMD *);
28  */
29 int
ex_yank(SCR * sp,EXCMD * cmdp)30 ex_yank(SCR *sp, EXCMD *cmdp)
31 {
32 	NEEDFILE(sp, cmdp);
33 
34 	/*
35 	 * !!!
36 	 * Historically, yanking lines in ex didn't count toward the
37 	 * number-of-lines-yanked report.
38 	 */
39 	return (cut(sp,
40 	    FL_ISSET(cmdp->iflags, E_C_BUFFER) ? &cmdp->buffer : NULL,
41 	    &cmdp->addr1, &cmdp->addr2, CUT_LINEMODE));
42 }
43