Sync usage with man page.
[netbsd-mini2440.git] / external / gpl2 / lvm2 / dist / doc / example_cmdlib.c
blob1778f4ac64aa23c2df394ed80c1aa618e3c5f4ff
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
6 * This file is part of LVM2.
8 * This copyrighted material is made available to anyone wishing to use,
9 * modify, copy, or redistribute it subject to the terms and conditions
10 * of the GNU General Public License v.2.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 #include "lvm2cmd.h"
19 /* All output gets passed to this function line-by-line */
20 void test_log_fn(int level, int dm_errno, const char *file, int line,
21 const char *format)
23 /* Extract and process output here rather than printing it */
25 if (level != 4)
26 return;
28 printf("%s\n", format);
29 return;
32 int main(int argc, char **argv)
34 void *handle;
35 int r;
37 lvm2_log_fn(test_log_fn);
39 handle = lvm2_init();
41 lvm2_log_level(handle, 1);
42 r = lvm2_run(handle, "vgs --noheadings vg1");
44 /* More commands here */
46 lvm2_exit(handle);
48 return r;