xref: /openbsd/usr.bin/vi/ex/ex_yank.c (revision cca36db2)
1 /*	$OpenBSD: ex_yank.c,v 1.5 2009/10/27 23:59:47 deraadt 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
30 ex_yank(sp, cmdp)
31 	SCR *sp;
32 	EXCMD *cmdp;
33 {
34 	NEEDFILE(sp, cmdp);
35 
36 	/*
37 	 * !!!
38 	 * Historically, yanking lines in ex didn't count toward the
39 	 * number-of-lines-yanked report.
40 	 */
41 	return (cut(sp,
42 	    FL_ISSET(cmdp->iflags, E_C_BUFFER) ? &cmdp->buffer : NULL,
43 	    &cmdp->addr1, &cmdp->addr2, CUT_LINEMODE));
44 }
45