Sync with FreeBSD. This adds read-only support for zip and ISO9660.
[dragonfly.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 #ifndef lint
13 static const char sccsid[] = "@(#)ex_put.c      10.7 (Berkeley) 3/6/96";
14 #endif /* not lint */
15
16 #include <sys/types.h>
17 #include <sys/queue.h>
18
19 #include <bitstring.h>
20 #include <ctype.h>
21 #include <limits.h>
22 #include <stdio.h>
23 #include <string.h>
24
25 #include "../common/common.h"
26
27 /*
28  * ex_put -- [line] pu[t] [buffer]
29  *      Append a cut buffer into the file.
30  *
31  * PUBLIC: int ex_put __P((SCR *, EXCMD *));
32  */
33 int
34 ex_put(sp, cmdp)
35         SCR *sp;
36         EXCMD *cmdp;
37 {
38         MARK m;
39
40         NEEDFILE(sp, cmdp);
41
42         m.lno = sp->lno;
43         m.cno = sp->cno;
44         if (put(sp, NULL,
45             FL_ISSET(cmdp->iflags, E_C_BUFFER) ? &cmdp->buffer : NULL,
46             &cmdp->addr1, &m, 1))
47                 return (1);
48         sp->lno = m.lno;
49         sp->cno = m.cno;
50         return (0);
51 }