| 1 |  |  | /*	$OpenBSD: ex_put.c,v 1.6 2014/11/12 04:28:41 bentley 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 <ctype.h> | 
    
    | 19 |  |  | #include <limits.h> | 
    
    | 20 |  |  | #include <stdio.h> | 
    
    | 21 |  |  | #include <string.h> | 
    
    | 22 |  |  |  | 
    
    | 23 |  |  | #include "../common/common.h" | 
    
    | 24 |  |  |  | 
    
    | 25 |  |  | /* | 
    
    | 26 |  |  |  * ex_put -- [line] pu[t] [buffer] | 
    
    | 27 |  |  |  *	Append a cut buffer into the file. | 
    
    | 28 |  |  |  * | 
    
    | 29 |  |  |  * PUBLIC: int ex_put(SCR *, EXCMD *); | 
    
    | 30 |  |  |  */ | 
    
    | 31 |  |  | int | 
    
    | 32 |  |  | ex_put(SCR *sp, EXCMD *cmdp) | 
    
    | 33 |  |  | { | 
    
    | 34 |  |  | 	MARK m; | 
    
    | 35 |  |  |  | 
    
    | 36 |  |  | 	NEEDFILE(sp, cmdp); | 
    
    | 37 |  |  |  | 
    
    | 38 |  |  | 	m.lno = sp->lno; | 
    
    | 39 |  |  | 	m.cno = sp->cno; | 
    
    | 40 |  |  | 	if (put(sp, NULL, | 
    
    | 41 |  |  | 	    FL_ISSET(cmdp->iflags, E_C_BUFFER) ? &cmdp->buffer : NULL, | 
    
    | 42 |  |  | 	    &cmdp->addr1, &m, 1)) | 
    
    | 43 |  |  | 		return (1); | 
    
    | 44 |  |  | 	sp->lno = m.lno; | 
    
    | 45 |  |  | 	sp->cno = m.cno; | 
    
    | 46 |  |  | 	return (0); | 
    
    | 47 |  |  | } |