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