]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/nvi/ex/ex_put.c
sysctl(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / contrib / nvi / ex / ex_put.c
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 <ctype.h>
18 #include <limits.h>
19 #include <stdio.h>
20 #include <string.h>
21
22 #include "../common/common.h"
23
24 /*
25  * ex_put -- [line] pu[t] [buffer]
26  *      Append a cut buffer into the file.
27  *
28  * PUBLIC: int ex_put(SCR *, EXCMD *);
29  */
30 int
31 ex_put(SCR *sp, EXCMD *cmdp)
32 {
33         MARK m;
34
35         NEEDFILE(sp, cmdp);
36
37         m.lno = sp->lno;
38         m.cno = sp->cno;
39         if (put(sp, NULL,
40             FL_ISSET(cmdp->iflags, E_C_BUFFER) ? &cmdp->buffer : NULL,
41             &cmdp->addr1, &m, 1))
42                 return (1);
43         sp->lno = m.lno;
44         sp->cno = m.cno;
45         return (0);
46 }