1 /* This file is part of GDBM test suite.
2 Copyright (C) 2011 Free Software Foundation, Inc.
4 GDBM is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 GDBM is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with GDBM. If not, see <http://www.gnu.org/licenses/>.
27 ntos (int n, char *buf, size_t size)
46 main (int argc, char *argv[])
55 fprintf (stderr, "usage: %s PATH-TO-FDOP [-creat] [-write]\n", argv[0]);
59 for (i = 2; i < argc; i++)
61 if (strcmp (argv[i], "-creat") == 0)
62 flags = O_RDWR|O_CREAT;
63 else if (strcmp (argv[i], "-write") == 0)
67 fprintf (stderr, "%s: unknown option: %s\n",
77 d = dbm_open ("file", flags|O_CLOEXEC, 0600);
84 execl (argv[1], "fdop",
85 ntos (dbm_pagfno (d), fdbuf[0], sizeof (fdbuf[0])),
86 ntos (dbm_dirfno (d), fdbuf[1], sizeof (fdbuf[1])),