xref: /csrg-svn/contrib/ed/add_line.c (revision 57710)
1 /*-
2  * Copyright (c) 1992 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Rodney Ruddock of the University of Guelph.
7  *
8  * %sccs.include.redist.c%
9  */
10 
11 #ifndef lint
12 static char sccsid[] = "@(#)add_line.c	5.2 (Berkeley) 01/23/93";
13 #endif /* not lint */
14 
15 #include <sys/types.h>
16 
17 #include <db.h>
18 #include <regex.h>
19 #include <setjmp.h>
20 #include <stdio.h>
21 
22 #include "ed.h"
23 #include "extern.h"
24 
25 /*
26  * This is where the lines actually are put into the buffer.
27  */
28 recno_t
29 add_line(p, len)
30 	char *p;
31 	long len;
32 {
33 	DBT db_key, db_data;
34 	static recno_t l_key;
35 
36 	l_key++;
37 	(db_key.data) = &l_key;
38 	(db_key.size) = sizeof(recno_t);
39 	(db_data.data) = p;
40 	(db_data.size) = len;
41 	(dbhtmp->put)(dbhtmp, &db_key, &db_data, (u_int)(R_NOOVERWRITE));
42 	return(l_key);
43 }
44