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