• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/docs_src/ref/am/
1m4_ignore([dnl
2#include <sys/types.h>
3#include <string.h>
4
5#include <db.h>
6
7void	foo();
8void	handle_error(int);
9
10DB *dbp;
11DB_TXN *txn;
12int ret;
13
14int
15main()
16{
17	foo();
18	return (0);
19}
20
21void
22handle_error(ret)
23	int ret;
24{}
25
26void
27foo()
28{
29	struct student_record {
30		char student_id__LB__4__RB__;
31		char last_name__LB__15__RB__;
32		char first_name__LB__15__RB__;
33	};])
34
35m4_indent([dnl
36struct student_record s;
37DBT data, key;
38m4_blank
39memset(&key, 0, sizeof(DBT));
40memset(&data, 0, sizeof(DBT));
41memset(&s, 0, sizeof(struct student_record));
42key.data = "WC42";
43key.size = 4;
44memcpy(&s.student_id, "WC42", sizeof(s.student_id));
45memcpy(&s.last_name, "Churchill      ", sizeof(s.last_name));
46memcpy(&s.first_name, "Winston        ", sizeof(s.first_name));
47data.data = &s;
48data.size = sizeof(s);
49if ((ret = dbp-__GT__put(dbp, txn, &key, &data, 0)) != 0)
50	handle_error(ret);])
51m4_ignore([}])
52